how to get the stash back after pulling

farm command picture farm command · Dec 16, 2016 · Viewed 41.9k times · Source

Yesterday I made some changes on the master branch but didn't commit them, today I tried to pull the master but it said I have to commit or stash my changes Please, commit your changes or stash them before you can merge. I stashed them git stash and then pulled from master git pull now I have done some changes in my code but figured out that should have done the stash and i had to commit the changes. Now what can I do to have

1) the changes from stash back

2) what I got from git pull

3) and my current changes

I found this post here but the person hadn't pulled from master, so I am not sure the answers there would work for me and cannot really risk it and try as it is on master.

Answer

Vampire picture Vampire · Dec 16, 2016

Just use git stash pop or git stash apply. As long as the stashed changes do not conflict with what you pulled or edited, it will just work, if not you get some merge conflicts that you can resolve like when you do a merge or rebase.