git error: path is unmerged

Josh Sherman
1 min read
Software Development Version Control

While attempting to update my dotfiles locally on my MacBook Pro, I ran into a bit of a dilemma with one of my files that I had edited but never committed.

Not a big deal, I can just run git stash and apply the changes again later. No such luck though, when attempting to stash I was advised that the file needed merged:

% git stash
vim/.vimrc: needs merge

Kind of weird, but okay. Honestly, I don’t really remember what I did to get into this state, but my next thought was to try to abort the merge, assuming there was a merge in action:

% git merge --abort
fatal: There is no merge to abort (MERGE_HEAD missing).

So that was a bust. At this point, I made a copy of the locally modified file, and then attempted to check it out, thinking that would get me back into a state in which I could pull the latest code:

git checkout vim/.vimrc
error: path 'vim/.vimrc' is unmerged

Back to where we started, with a slightly different error message.

Running out of options, I tried to reset the file, to hopefully blow away any gremlins in the state that were keeping me from moving forward:

% git reset vim/.vimrc
Unstaged changes after reset:
M	vim/.vimrc

So far so good. Evidently I had previously staged the file for commit but never followed through with it. After doing a reset on the file, I was free to stash or checkout the offending file, and get on with my day.

Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Engineering Manager and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.

Currently Reading

Parasie Eve

Previous Reads

Buy Me a Coffee Become a Sponsor

Related Articles