1

There is this anomalous condition when rebasing, where I have basically finished rebasing a long branch, resolved a conflict, issued git rebase --continue, and I get slapped over the mug with the following:

Applying: <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".

The vagueness of "chances are" and "something else" is not something I can work with. I need to know exactly:

  1. whether "something" did or didn't "introduce the same change" (no "chances")
  2. what that "something" was
  3. what the OTHER "something" was that also introduced "the same change", and
  4. what the change was.

How can I recover this information?

Szczepan Hołyszewski
  • 2,707
  • 2
  • 25
  • 39

1 Answers1

0

Basically, what is happening in a git rebase is that it is re-applying all of your commits, one-by-one, on top of the latest HEAD code in master if you for example executed $ git rebase origin/master. I usually get into this state when, as you said, there are a lot of commits in your branch.

Normally, when git gets into this state for me, I take a backup of my code, then execute this command:

$ git rebase --abort

Then I checkout a totally new, up-to-date branch from master, and re-apply all my code changes manually. This way I don't have to both with or in other words is a workaround to the git rebase.

The other option is, if you want to skip one of the commits to try and finish the git rebase (if the change already existed upstream for example), use this command, but beware that in this case there is a chance that some code changes might be lost:

$ git rebase --skip

For more details on the risks of git rebase --skip, please see What exactly does git rebase --skip do?

user8128167
  • 6,929
  • 6
  • 66
  • 79