From: Junio C Hamano Date: Tue, 22 Jul 2014 21:39:27 GMT Subject: Re: [RFH] "git clean" deletes excluded files in untracked directories Message-ID: In-Reply-To: <20140702191114.GA3474@sigill.intra.peff.net> Jeff King writes: > 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/two and "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 ;-)