Git pull aborts

July 25, 2015 in #git

Frequently, I'll be working on a remote and a local copy at the same time. Perhaps this is a bad overall workflow and needs to be rethought. But often, I'll make changes in two locations but only wish to save one but wish to update the other with the changes. When I try to pull down my changes - git complains:

$ git pull
Updating f1678b7..a75ac7f  
error: Your local changes to the following files would be overwritten by merge:  
Please, commit your changes or stash them before you can merge.  

The answer is not too complicated:

git stash save --keep-index  
git stash drop  
git pull