Search code examples
gitgit-branchgit-mergegit-rebase

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?


Solution

  • 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.