Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is commit needed after resolving merge conflict during Git rebase?

I rebase another branch onto my checkout branch and I get a conflict during rebase. i resolved the merge conflict.

$ git status
rebase in progress; onto 77c951b
You are currently rebasing branch 'test' on '77c951b'.
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

        modified:   br_boss_buha_faktura/forms/br_boss_buha_faktura_head_dtl.frm
        modified:   br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client.val
        new file:   br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client_name.val

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client.val

Do I need to commit the above resolved merge conflict git commit or can I directly go further using git rebase --continue?

like image 973
BuZZ-dEE Avatar asked Sep 30 '14 07:09

BuZZ-dEE


People also ask

Do I need to commit after merge conflict?

If there were uncommitted worktree changes present when the merge started, git merge --abort will in some cases be unable to reconstruct these changes. It is therefore recommended to always commit or stash your changes before running git merge.

Do I need to commit again after rebase?

The purpose of rebase is make your commits look as if they were changes to the branch you rebase onto. So the most logical way is to incorporate merge conflicts into these commits. No additional commits is required thus.


Video Answer


2 Answers

Some good answers here but to answer the question. NO you do not need to commit after resolving the merge conflict.

Once you have added the resolution to the git staging area via git add <file> a git rebase --continue will make the commit for you using the original commit message.

NOTE the commit hash will change! So when you go to merge this into another branch that has commits that you altered in your branch you will have issues merging those branches together.


NOTE I said you do not need to git commit after resolving a git rebase conflict, but you can if you want to.

It may be useful to split files from one commit into a series of individual commits if it makes more sense. Usually you just want to resolve the conflict though. As is shown here: Break a previous commit into multiple commits.

like image 125
Breedly Avatar answered Oct 12 '22 11:10

Breedly


If you DO commit your changes, I believe that you can do a git rebase --skip to skip over the now non-existent merge conflict.

like image 28
John B Avatar answered Oct 12 '22 13:10

John B