Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git rebase --continue no changes

Tags:

git

git-rebase

I have two branches with two features: banch_1 and branch_2. branch_2 uses feature from branch_1. I've made changes in the branch_1 and want to rebase branch_2 on branch_1 to get changes from branch_1 into branch_2.

So, I'm checking out on branch_2:

git checkout branch_2 

And trying to rebase on branch_1:

git rebase branch_1 

After that I get 'Merge conflict' for two files. So I run

git mergetool -t meld 

and resolving that conflicts, choosing changes from branch_1.

I'm saving files and going to terminal, typing git status and see that there is no changes in git index. Next I run git rebase --continue and getting

No changes - did you forget to use 'git add'?  

error. But there is nothing to add! I type git log and see commit from branch_1 but there is no commit from branch_2.

What I'm doing wrong?

like image 706
Paul Avatar asked Dec 10 '15 14:12

Paul


People also ask

How do I force git to rebase continue?

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

What is git rebase continue?

When you're finished making all your changes, you can run git rebase --continue . As before, Git is showing the commit message for you to edit. You can change the text ( "i cant' typ goods" ), save the file, and close the editor. Git will finish the rebase and return you to the terminal.

Is it possible to git rebase and skip all conflicts?

You can run git rebase --skip to completely skip the commit. That means that none of the changes introduced by the problematic commit will be included. It is very rare that you would choose this option. You can fix the conflict.


1 Answers

If I understand correctly, when you're getting the merge conflict, you're accepting all the changes from branch_1, meaning that that particular commit from branch_2 is irrelevant - any changes in that commit are identical to the incoming changes from branch_1.

When git is saying

No changes - did you forget to use 'git add'?

it's telling you that the commit you're trying to apply doesn't make any changes to the repo, and therefore there's no reason for it to exist.

The simple solution to that is git rebase --skip, which just says "ignore this commit and move on" as suggested in @C-Otto's comment. This will skip the commit you're currently dealing with, and move on to subsequent ones.

You might also find it easier to use interactive rebasing (git rebase -i), which first presents you with a list of the commits it will apply, and gives you various options for what to do with each individual commit. In this case, if you identify a commit that is no longer relevant, you can skip it up-front, so you'll never see the conflict in the first place.

like image 184
DaveyDaveDave Avatar answered Sep 24 '22 09:09

DaveyDaveDave