Mgalx
Mgalx

Reputation: 33

Undetected changes during git rebase

I am facing a rebase issue since after adding files for which I resolved conflicts, the error "No changes - did you forget to use 'git add'?" arises as soon as I try to continue rebase. Do anyone have a clue please ?

Thanks.

Upvotes: 0

Views: 304

Answers (3)

Mgalx
Mgalx

Reputation: 33

Got it; @poke's "git commit --allow-empty" set me in the right direction: I used "commit --amend" before pushing to remote master to make it "transparent" for the rest of the team whereas I needed a brand new commit to avoid conflicts.

Upvotes: 0

poke
poke

Reputation: 387567

If Git tells you that, then you have no actual changes to commit. This can happen in a rebase situation when your conflict resolution ended up resulting in no changes for the commit your are currently rebasing. A common reason for this could be that the changes were already contained in the base commit, making the rebased commit redundant.

Git will then warn you that it has nothing to commit/rebase. In that case, you can either decide to commit an empty commit (git commit --allow-empty), or you can simply skip this current commit (since it doesn’t contain anything). Just do git rebase --skip then.

Upvotes: 1

axiac
axiac

Reputation: 72206

This happens when you solve a conflict by choosing "their" version of the file (or if you manually edit the file and apply the changes and in the end the file is identical with "their" version).

If after you have solved all the conflicts there are no changes to the working tree, git commit doesn't have anything to do. git rebase --continue wants to run the equivalent of git commit to apply the commit it is working on but git commit, by default, doesn't create an empty commit.

In this case, you should run git rebase --skip instead of git rebase --continue.

The rebase will skip the commit it is working on because, as of your conflict solving resolution, it doesn't introduce any change in the code.

Upvotes: 1

Related Questions