Re: [RFH] "git clean" deletes excluded files in untracked directories
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 22, 2014, 21:39 UTC
- Message-ID
- <xmqq8unlf4z4.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <20140702191114.GA3474@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 10 quoted lines
> If you have an untracked directory that contains excluded files, like > this: > > mkdir foo > echo content >foo/one > echo content >foo/two > echo "foo/one" >.gitignore > > then "git clean -d" will notice that "foo" is untracked and recursively > delete it and its contents, including the ignored "foo/one".
Hmph, starting from an empty repository and doing the above four commands, and "git clean" without "-d" does not bother removing either foo/one or foo/two. Is this correct?
It gets worse. Following the above four commands and then these two:
>foo/three
git add foo/twoand "git clean" (with or without "-d") suddenly notices that "foo/three" is expendable, but not foo/one nor foo/two, which sounds about right.
Honestly, as I do not use "git clean" myself, I do not know what the "right" behaviour is for that command. Anything it does seems just arbitrary and wrong to me ;-)