3

I just finished resolving some conflicts due to a pull from the remote repository of my project.

I know that once conflicts have been resolved you have, to my knowledge, 2 solutions :

  • git rebase --continue
  • git commit -m "foobar"

I was just wondering if there are any differences between those 2 operations, in this context only, as I know they are fundamentally different in their basic form ?

1 Answer 1

7

EDIT #2:

If you initiated this situation with git pull, the expected resolution is to use git commit, because you are creating a new commit to represent the successful merge. If this situation was initiated with git pull --rebase, you would want to use git rebase --continue as mentioned in my original answer, as this will reuse the same commits without creating any new ones.

Original answer (in which I assumed this was initiated with git pull --rebase):

I can tell you that the recommended method is to use git rebase --continue. (See here: http://git-scm.com/docs/git-rebase)

The git commit method may work, but it may change your commit history if you don't use the -C flag, which is what resolving a git merge will recommend. I suppose it is also worth mentioning that the -m flag will change the log message, whereas the git rebase --continue will reuse the old commit message without asking.

EDIT:

Further research confirms my suspicions that the git commit method is dangerous and may leave your repo in an undesirable state. See here: http://www.tigraine.at/2011/08/10/dont-commit-when-you-rebase and here: Forgot "git rebase --continue" and did "git commit". How to fix?

Sign up to request clarification or add additional context in comments.

8 Comments

The problem is that the official Git user guide tells to commit after resolving conflicts (last sentence) : git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging
That page relates to merging. Rebasing is a different operation even though it might seem similar.
Pull is fetch + merge. So my problem is related to merging, not rebasing, even if this command is used to end the merge.
So wait, did you initiate all of this with git pull or git pull --rebase? I assumed it was the latter, since you mentioned using the git rebase --continue command, but if you started with a merge, you definitely don't want to use any rebase commands!
I used git pull, but anyway git rebase --continue also works, which is kind of weird. That's why I posted.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.