Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [RFH] "git clean" deletes excluded files in untracked directories

From: Junio C Hamano <hidden>
Date: 2016-06-15 23:02:00

Jeff King [off-list ref] 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 ;-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help