问题
I am new to Git and I am using EGit eclipse plugin to commit.
I modified few files and I stashed the changes, then I did git pull
in command line which pulled up all the latest commits. Then I did Apply stashed changes
from EGit. Now it applied my changes and the changes which pulled from last commit of stashed files went out. I am not sure why it didn't ask me about merge conflicts and overwrote my changes and lost previous commits changes.
How to get those changes?
回答1:
When you have changes on your working copy, from command line do:
git stash
This will stash your changes and clear your status report
git pull
This will pull changes from upstream branch. Make sure it says fast-forward in the report. If it doesn't, you are probably doing an unintended merge
git stash pop
This will apply stashed changes back to working copy and remove the changes from stash unless you have conflicts. In the case of conflict, they will stay in stash so you can start over if needed.
if you need to see what is in your stash
git stash list
来源:https://stackoverflow.com/questions/12476239/git-stash-and-git-pull