threads / discuss / 28602

List of directories containing only ignored files

Subject: List of directories containing only ignored files

## tl;dr

3 messages between Oct 6, 2011 and Oct 6, 2011.

replies: 2people: 2as markdown or json

Marcin Wiśnicki· Oct 6, 2011, 13:56 UTC · lore

What's the easiest way to find all directories that contain only ignored files but are not ignored themselves.

For example, given following .gitignore:
  obj/
and following files:
  /project1/foo.c
  /project1/obj/foo.o
  /project2/obj/bar.o

Where /project2 contains leftovers from different branch that are not cleared on switch because they are ignored.

I would like to see:
  /project2
Alternatively: how to remove such leftovers when switching branches ?
Andreas Ericsson· Oct 6, 2011, 14:03 UTC · re: Marcin Wiśnicki · lore

Re: List of directories containing only ignored files

On 10/06/2011 03:56 PM, Marcin Wiśnicki wrote:
>
> Alternatively: how to remove such leftovers when switching branches ?
git clean -X -f
-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.
Marcin Wiśnicki· Oct 6, 2011, 14:32 UTC · re: Andreas Ericsson · lore

Re: List of directories containing only ignored files

2011/10/6 Andreas Ericsson <ae@op5.se>:
Show 6 quoted lines
> On 10/06/2011 03:56 PM, Marcin Wiśnicki wrote:
>>
>> Alternatively: how to remove such leftovers when switching branches ?
>
> git clean -X -f
>
That also would delete /project1/obj/foo.o which is not what I wanted.
Anyway I think I have found the answer:
 git ls-files -o --directory --exclude-standard

← back to recent threads