Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I merge local modifications with a git stash without an extra commit?

Tags:

git

I stashed my changes to work on another task. When I finished the other task, I resumed work on the modifications I stashed, except that I forgot to pop them first. Now I have partially completed work both as local modifications and in the git stash. When I try to merge them using git stash pop, I get the following error:

error: Your local changes to the following files would be overwritten by merge:
    file.js
Please, commit your changes or stash them before you can merge.
Aborting

I would like git to merge the stashed changes locally before committing. I've tried searching around a bit for a solution but have come up empty so far.

Your help is much appreciated!

like image 977
Tres Avatar asked Feb 28 '13 02:02

Tres


1 Answers

I figured it out. I needed to stage my local changes for commit prior to git stash pop, so I just did a git add file.js and then git stash pop and the merge proceeded as expected. Hope this helps someone!

like image 123
Tres Avatar answered Sep 28 '22 18:09

Tres