Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git rebase repeatedly asking me to run `git rebase --continue`

Tags:

git

git-rebase

I am on my feature branch my-feature, I run rebase develop branch:

(my-feature)$ git rebase develop

Terminal shows a bunch of conflicts, and it is in detached mode now:

(detached*)$

I resolved those conflicts in detached mode and committed them. Then, I run git rebase --continue, but now git again prompt me the following:

(detached*)$ git rebase --continue
Applying: my-feature my commit message
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.

Resolve all conflicts manually, mark them as resolved with
"git add/rm <conflicted_files>", then run "git rebase --continue".
You can instead skip this commit: run "git rebase --skip".
To abort and get back to the state before "git rebase", run "git rebase --abort".

So, I again run git rebase --continue, but the same message shows to me, it is endless as long as I run git rebase --continue. Why? So, what am I supposed to do after I resolved conflicts to rebase to develop branch?

like image 270
Leem Avatar asked Mar 04 '23 14:03

Leem


1 Answers

When resolving a conflict on a rebase, you should not commit them, let the rebase handle the commit part*.

*Unless you are in an interactive rebase, where you can stop for amending commits.

Once you have edited the conflictual files you must add them (not commit) and then you can git rebase --continue. Here is an example:

git rebase develop
# conflict
vi file-with-conflict
git add file-with-conflict
git rebase --continue

This will continue rebasing to the next step (next commit), and if there is a new conflict, you will have to resolve it the same way. And so on until there is neither conflict to solve nor commits to rebase.


In your case, you may need to first git rebase --abort to get a clean slate, and then try again to rebase.

like image 105
Ulysse BN Avatar answered Apr 29 '23 10:04

Ulysse BN