emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: After a git merge and manual correction of a conflict, how do I tell


From: Kelvin White
Subject: Re: After a git merge and manual correction of a conflict, how do I tell git the conflict is fixed?
Date: Wed, 27 May 2015 03:14:12 +0000



On Tue, May 26, 2015 at 10:55 PM Kelvin White <address@hidden> wrote:
On Tue, May 26, 2015 at 10:40 PM Stefan Monnier <address@hidden> wrote:
>  Which will have the exact same effects as `git rm --cached <file>' 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 <file>' will remove it from the curennt index, while `git rm --cache <file>' 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...

address@hidden ~/src/emacs-dev $ git checkout -b test
Switched to a new branch 'test'
address@hidden ~/src/emacs-dev $ echo "moo" >> test_file
address@hidden ~/src/emacs-dev $ git status
# On branch test
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# test_file
nothing added to commit but untracked files present (use "git add" to track)
address@hidden ~/src/emacs-dev $ git add test_file
address@hidden ~/src/emacs-dev $ git status
# On branch test
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# new file:   test_file
#
address@hidden ~/src/emacs-dev $ git commit -m "adding test file"
[test dde69ae] adding test file
 1 file changed, 2 insertions(+)
 create mode 100644 test_file
address@hidden ~/src/emacs-dev $ git status
# On branch test
nothing to commit, working directory clean
address@hidden ~/src/emacs-dev $ git rm --cached test_file
rm 'test_file'
address@hidden ~/src/emacs-dev $ git status
# On branch test
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
# deleted:    test_file
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# test_file
address@hidden ~/src/emacs-dev $ git commit -am "removing test file"
[test 46f7f53] removing test file
 1 file changed, 2 deletions(-)
 delete mode 100644 new_file
address@hidden ~/src/emacs-dev $ git status
# On branch test
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# new_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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]