On Tue, May 26, 2015 at 11:14 PM Kelvin White wrote: > On Tue, May 26, 2015 at 10:55 PM Kelvin White wrote: > >> On Tue, May 26, 2015 at 10:40 PM Stefan Monnier >> wrote: >> >>> > Which will have the exact same effects as `git rm --cached ' no? >>> >>> Not at all. "git rm ..." will remove the file from the repository, >>> i.e. it will have an effect for *everyone else*. >>> >>> >>> Stefan >>> >>> >> Forgive me, but I think the confusion here is due to the fact that `git >> reset ' will remove it from the curennt index, while `git rm --cache >> ' will remove it from the repository completely, while leaving the >> current local copy in tact. >> > > In this case, this is exactly what you would want. Why would you want to > keep this file in version control for everyone else? Consider this... > > l3thal@dev ~/src/emacs-dev $ git checkout -b test > Switched to a new branch 'test' > l3thal@dev ~/src/emacs-dev $ echo "moo" >> test_file > l3thal@dev ~/src/emacs-dev $ git status > # On branch test > # Untracked files: > # (use "git add ..." to include in what will be committed) > # > # test_file > nothing added to commit but untracked files present (use "git add" to > track) > l3thal@dev ~/src/emacs-dev $ git add test_file > l3thal@dev ~/src/emacs-dev $ git status > # On branch test > # Changes to be committed: > # (use "git reset HEAD ..." to unstage) > # > # new file: test_file > # > l3thal@dev ~/src/emacs-dev $ git commit -m "adding test file" > [test dde69ae] adding test file > 1 file changed, 2 insertions(+) > create mode 100644 test_file > l3thal@dev ~/src/emacs-dev $ git status > # On branch test > nothing to commit, working directory clean > l3thal@dev ~/src/emacs-dev $ git rm --cached test_file > rm 'test_file' > l3thal@dev ~/src/emacs-dev $ git status > # On branch test > # Changes to be committed: > # (use "git reset HEAD ..." to unstage) > # > # deleted: test_file > # > # Untracked files: > # (use "git add ..." to include in what will be committed) > # > # test_file > l3thal@dev ~/src/emacs-dev $ git commit -am "removing test file" > [test 46f7f53] removing test file > 1 file changed, 2 deletions(-) > delete mode 100644 test_file > l3thal@dev ~/src/emacs-dev $ git status > # On branch test > # Untracked files: > # (use "git add ..." to include in what will be committed) > # > # test_file > nothing added to commit but untracked files present (use "git add" to > track) > This is the same situation as a merge conflict in a file that you dont want to keep in the remote git repo.. You need to remove it from the index and keep it locally.