Reputation: 9546
I have two branches, master
and side
. I'm tracking file somedoc.txt
in both branches.
Switched to side
using:
git checkout side
Made a change to line 1 of somedoc.txt
.
Committed my changes with:
git commit -a -m "made some changes"
Switched back to master
:
git checkout master
Merged changes:
git merge side
Got the expected Merge conflict in somedoc.txt
.
Edited somedoc.txt
to resolve the <<<<<< HEAD ... side >>>>>>
conflict.
Added somedoc.txt
with:
git add somedoc.txt
Tried to commit with:
git commit
At this point I got the error:
error: 'commit' is not possible because you have unmerged files.
Running git status
gives the following:
On branch master
You have unmerged paths.
(fix conflicts and run "git commit")
Unmerged paths:
(use "git add <file>..." to mark resolution)
both modified: somedoc.txt
no changes added to commit (use "git add" and/or "git commit -a")
When I go back in to edit somedoc.txt
I don't see the conflict tags. How do I resolve this?
Upvotes: 1
Views: 307
Reputation: 19318
You need to finish the merge off. Once you've fixed any conflicts run git commit -a
.
In response to your comment git commit
on it's own wouldn't have worked. At that point you hadn't marked the file as resolved using git add
which is why you were presented with an error. The -a
switch will automatically add known files.
Upvotes: 1