file deletion in index lost after checkout -b
- From
- Jing Xue <jingxue@digizenstudio.com>
- Date
- Sep 1, 2008, 03:44 UTC
- Message-ID
- <20080901034414.GR6619@jabba.hq.digizenstudio.com>
In Git 1.6.0 the following sequence:
$ git init $ echo 'abcdefgh' >1.txt $ echo '12345678' >2.txt $ git add 1.txt 2.txt $ git commit -m 'init' $ git rm 2.txt $ echo 'qwertyuiop' >>1.txt $ git add 1.txt $ echo 'asdfghjkl;' >3.txt $ git add 3.txt $ git status $ git checkout -b foo $ git status
produces this output:
Initialized empty Git repository in /home/jingxue/workspace/sandboxes/test.git/.git/ Created initial commit 918f3c6: init 2 files changed, 2 insertions(+), 0 deletions(-) create mode 100644 1.txt create mode 100644 2.txt rm '2.txt' # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: 1.txt # deleted: 2.txt # new file: 3.txt # M 1.txt A 3.txt Switched to a new branch "foo" # On branch foo # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: 1.txt # new file: 3.txt #
The deletion of 2.txt appears lost during 'checkout -b foo', while the modification and addition were both brought over. Is it a bug?
Cheers.
-- Jing Xue