I had a real case of this happening and causing confusion. Not sure it if 
is a bug. This is using git 1.9.1.

In short, if you checkout a repo where a file staged for deletion has 
already been deleted, the staged deletion disappears permanently. When you 
return to the branch where you made the deletion, it is as if the change 
has been commited. Here is the simplest repo I could come up with:

/tmp $ mkdir repo
/tmp $ cd repo
/tmp/repo $ git init
Initialized empty Git repository in /tmp/repo/.git/
/tmp/repo $ touch foo
/tmp/repo $ git add .
/tmp/repo $ git commit -m 'added foo'
[master (root-commit) 02c4282] added foo
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 foo
/tmp/repo $ git checkout -b do_something_else
Switched to a new branch 'do_something_else'
/tmp/repo $ git rm -f foo
rm 'foo'
/tmp/repo $ git commit -m 'deleted foo'
[do_something_else c2bb950] deleted foo
 1 file changed, 0 insertions(+), 0 deletions(-)
 delete mode 100644 foo
/tmp/repo $ git checkout master
Switched to branch 'master'
/tmp/repo $ git rm -f foo
rm 'foo'
/tmp/repo $ git status
On branch master
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)


 deleted:    foo


/tmp/repo $ git checkout do_something_else
Switched to branch 'do_something_else'
/tmp/repo $ git checkout master
Switched to branch 'master'
/tmp/repo $ git status
On branch master
nothing to commit, working directory clean


-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to