Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git rebase fails with conflicts, but there are no conflicts

I tried to do a rebase on code that I had committed but not pushed, because I had heard that there were some changes in the origin that might affect what I was working on. Here's what I get:

$ git rebase origin/thor-develop
First, rewinding head to replay your work on top of it...
Applying: PH-2127: F193: SYO for Signed in User
Using index info to reconstruct a base tree...
M       js/angular/localization/StoreListCtrl.js
M       templates/default_site/site_embed.group/html_header.html
<stdin>:17: trailing whitespace.

<stdin>:73: trailing whitespace.

<stdin>:77: trailing whitespace.

<stdin>:78: trailing whitespace.
                            $scope.address_dropdown = addressStore.getTop($scope.my_occasion, 3);
<stdin>:79: trailing whitespace.

warning: squelched 16 whitespace errors
warning: 21 lines add whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging templates/default_site/site_embed.group/html_header.html
Auto-merging js/angular/localization/StoreListCtrl.js
CONFLICT (content): Merge conflict in js/angular/localization/StoreListCtrl.js
Failed to merge in the changes.
Patch failed at 0001 PH-2127: F193: SYO for Signed in User

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

We use Tortoise Git as a front-end editor, so I went into the Resolve tool. It usually shows differences, which are of course OK, and conflicts, which are not. It shows me absolutely no conflicts in the file referenced (StoreListCtrl.js). There are obviously differences, but no conflicts at all. What does this mean, and how do I fix it so I can complete the rebase and eventually merge my code?

like image 762
EmmyS Avatar asked Mar 18 '14 17:03

EmmyS


People also ask

Why do I get conflicts when rebasing?

Handling Conflicts When Rebasing When applying commits to a new base state, it is possible that the new base has made changes that are conflicting with the changes you are trying to apply. For example, if on main someone edited the same file and line you did on your branch. The same thing happens when merging.

Can rebase have conflicts?

If the change that you submitted has a merge conflict, you need to manually resolve it using git rebase. Rebasing is used to integrate changes from one branch into another to resolve conflicts when multiple commits happen on the same file. Never do a rebase on public (master) branches.


1 Answers

It's possible the resolve tool fixed the conflicts for you automatically. It's happened to me (and confused me) before. In this case, you can probably go straight to git rebase --continue.

The full checklist is:

  • if git status shows any un-staged changes:
    • if those files have the chevrons <<< >>> marking conflicts:
      • fix the conflicts and save the files
    • now stage all un-staged changes with git add: this marks the conflicts as resolved
  • now any conflicts are resolved and marked: use git rebase --continue
like image 95
Useless Avatar answered Oct 12 '22 23:10

Useless