BuZZ-dEE
BuZZ-dEE

Reputation: 6949

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?

Upvotes: 19

Views: 10436

Answers (4)

John B
John B

Reputation: 20390

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.

Upvotes: 1

Breedly
Breedly

Reputation: 14266

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.

Upvotes: 22

Gopi
Gopi

Reputation: 19874

Here I see

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

Please do

git add br_boss_buha_faktura/valuelists/br_boss_buha_faktura_client.val

Then

git rebase --continue

Upvotes: 4

rubenvb
rubenvb

Reputation: 76711

Doing a git rebase --continue will rewrite the current commit you are applying to the form you changed it to. It will commit the changes under the same name you had in the test branch.

Note you are rebasing on a commit, might be a detached HEAD state! Usually, one rebases on master or a staging branch.

Upvotes: 1

Related Questions