TieDad
TieDad

Reputation: 9899

How to resolve conflict during rebase?

I have two branches:

  $ git branch
    master
  * readcode

I had some changes committed to master, so I wanted to bring the changes to readcode branch. Then I used rebase:

$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Health score enhancement.
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging file1
CONFLICT (content): Merge conflict in file1
Failed to merge in the changes.
Patch failed at 0001 Health score enhancement.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

In file1, there was a few lines of conflict. I have fixed the conflict in file1 in the editor. But I found that I was not in readcode branch now:

$ git branch
* (no branch)
  master
  readcode

But I still followed the hint message to do:

$ git rebase --continue
file1: needs merge
You must edit all merge conflicts and then
mark them as resolved using git add

Then use git add and continue again:

$ git add lib/nimbus/loadbalancer/lb.rb
$ git rebase --continue
Applying: Health score enhancement.
No changes - did you forget to use 'git add'?
If there is nothing left to stage, chances are that something else
already introduced the same changes; you might want to skip this patch.

When you have resolved this problem run "git rebase --continue".
If you would prefer to skip this patch, instead run "git rebase --skip".
To restore the original branch and stop rebasing run "git rebase --abort".

Which command should I do to tell git that I have resolved the conflict, and continue the rebase?

Upvotes: 2

Views: 4128

Answers (2)

jp gao
jp gao

Reputation: 1

I also encountered this problem recently the reason for this may be that you deleted all the changes you submitted during the conflict resolution presess.

so git thinks there is no changes and not necessary to generate patch.

so the suggest is use git rebase --skip, and the result is your commit that caused the conflict is discarded

You can reproduce the problem locally

Upvotes: 0

Michael Wild
Michael Wild

Reputation: 26341

Did you read the output that got posted by the error message? It clearly says that you should use

git rebase --continue

Upvotes: 1

Related Questions