The status of files which are not checked should be the same after commit
By 79113...@qq.com on June 26, 2015 09:21 (imported from Google Code)
Let us suppose we have 3 files, the contents of these 3 files are all the same, just call them 1.txt 2.txt 3.txt, now we rename 1.txt to 11.txt, delete 2.txt but keep local file, delete 3.txt not keep local file. and modify some other files, such as 4.txt
now the staus of the files are like this:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 13 commits.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD ..." to unstage)
renamed: 1.txt -> 11.txt
deleted: 2.txt
deleted: 3.txt
Changes not staged for commit:
(use "git add ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
modified: 4.txt
Untracked files:
(use "git add ..." to include in what will be committed)
2.txt
now we use tortoise git to commit, on the commit dialogbox, we only select 4.txt, make the other 3 files unselected, and then commit, after commitment ,we can see the status of files is like this
$ git status
On branch master
Your branch is ahead of 'origin/master' by 14 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add/rm ..." to update what will be committed)
(use "git checkout -- ..." to discard changes in working directory)
deleted: 1.txt
deleted: 3.txt
Untracked files:
(use "git add ..." to include in what will be committed)
11.txt
no changes added to commit (use "git add" and/or "git commit -a")
the status now is different from that before commit,
- 2.txt become a normal git file, not a deleted file
- 1.txt has been renamed to 11.txt, but now appears, that means 1.txt and 11.txt exist at the same time
- 11.txt becomes a new file, not a renamed file
this time we commit again and select all the files to commit, we can see the file 2.txt which we want to delete now become a normal file.
I think when we handle those unchecked rename files when commit we should consider the original file name and mofied file name. When add those unchecked files to index after commit, we should use git_index_remove API to remove the original file from the index
The version of TortoiseGit is 1.8.8.0
git version is 1.9.0.msysgit.0
On Win7