merge-conflicts icon indicating copy to clipboard operation
merge-conflicts copied to clipboard

"Nothing to Merge" issue after a conflicting git rebase

Open astorije opened this issue 10 years ago • 9 comments

It seems like I am getting bitten by a Nothing to Merge issue.

After running git rebase master on a branch and it created conflicts, I get the following status:

$ git status
rebase in progress; onto [commit redacted]
You are currently rebasing branch [branch redacted] on [commit redacted].
  (all conflicts fixed: run "git rebase --continue")

Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

    modified:   [app/controllers/users_controller.rb]
    modified:   app/views/users/index.html.erb

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   config/routes.rb

And as a matter of fact, I can see the following in my config/routes.rb:

<<<<<<< HEAD
  [Their lines]
=======
  [My lines]
>>>>>>> [Commit redacted]

However, when I run the detection, I get:

Nothing to Merge
No conflicts here!

Note that gitwas properly installed in /usr/local/bin/git.

astorije avatar Jul 13 '15 13:07 astorije

merge-conflicts uses a file's status in the git index to determine whether or not conflicts exist, so this line in your status output is a hint about the problem:

rebase in progress; onto [commit redacted]
You are currently rebasing branch [branch redacted] on [commit redacted].
  (all conflicts fixed: run "git rebase --continue")

Did you run git add config/routes.rb before attempting to detect conflicts? If you did, you told git (and therefore this package) that you've already dealt with any conflicts in that file, so there's nothing more to resolve!

I believe you can restore the "unresolved" bit in the index by running:

git update-index --unresolve config/routes.rb

smashwilson avatar Jul 13 '15 13:07 smashwilson

Hi @smashwilson,

Nop, the git status above is the first thing I did after the git rebase that showed us the conflict. No git add. I had to manually pursue anyway so I can't run any more tests, but I'll keep this issue open to reproduce it next time I have a conflict, which should be soon enough.

astorije avatar Jul 14 '15 08:07 astorije

Weird! Yeah, ping me here if and when you reproduce.

If you also happen to see this on a repository that's public, it would also be helpful to have the URL of the repository and the SHAs of the commits that you're rebasing from and to.

smashwilson avatar Jul 16 '15 12:07 smashwilson

I am also experiencing this bug.

The merge conflict format is the same:

<<<<<<< HEAD
  [Their lines]
=======
  [My lines]
>>>>>>> [Commit redacted]

Glavin001 avatar Jul 28 '15 18:07 Glavin001

@Glavin001 Hmm. Can you share:

  1. The output of git status?
  2. The repository URL and current SHAs of the branches you're trying to merge, if the repository is public?

smashwilson avatar Jul 28 '15 19:07 smashwilson

For sure.

➜  api git:(glavin) git status
On branch glavin
Your branch is ahead of 'origin/glavin' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean
➜  api git:(glavin) git pull origin matt
From github.com:Skilltapper/api
 * branch            matt       -> FETCH_HEAD
Auto-merging config/routes.js
CONFLICT (content): Merge conflict in config/routes.js
Auto-merging config/policies.js
CONFLICT (content): Merge conflict in config/policies.js
Auto-merging api/models/User.js
Auto-merging api/controllers/UserController.js
CONFLICT (content): Merge conflict in api/controllers/UserController.js
Automatic merge failed; fix conflicts and then commit the result.
➜  api git:(glavin) ✗ git status
On branch glavin
Your branch is ahead of 'origin/glavin' by 1 commit.
  (use "git push" to publish your local commits)
You have unmerged paths.
  (fix conflicts and run "git commit")

Changes to be committed:

    modified:   api/models/Recommendation.js
    modified:   api/models/User.js
    modified:   api/services/JobQueueService.js

Unmerged paths:
  (use "git add <file>..." to mark resolution)

    both modified:   api/controllers/UserController.js
    both modified:   config/policies.js
    both modified:   config/routes.js

  1. No, the repository is not public.

Let me know if there's anything else I can help with. I have since resolved the merge conflicts manually, however.

Glavin001 avatar Jul 28 '15 19:07 Glavin001

@Glavin001 Odd, that one should have been detected as conflicting. You can tell by these lines in your status output:

You have unmerged paths.
  (fix conflicts and run "git commit")

Notice how the original reporter's status, instead, says (all conflicts fixed: run "git rebase --continue"), which indicates that git doesn't think there are any conflicts to detect, which is what I'm using as a source of truth. If you want to verify the exact output that merge-conflicts is interpreting, you can run git status --porcelain instead; the UU lines are the ones that it interprets as conflicted files.

Another thing I thought of to check: Is the root of the git repository (namely, the .git directory) at the root of the project in Atom? Otherwise, Atom currently doesn't detect the project as having a git repository at all (see #129).

smashwilson avatar Jul 28 '15 22:07 smashwilson

I keep seeing this inconsistently, BTW. Unfortunately, it's most of the time on private repos and at times when "dammit I need to commit/rebase/else these ASAP!" so I didn't take the time to build a nice report yet. I am keeping that issue in mind whenever I can though.

astorije avatar Aug 30 '15 21:08 astorije

I am seeing this as well. Happens a lot during merging.. Usually what helps is: to restart atom editor completely.

art-divin avatar Sep 20 '15 13:09 art-divin