git stash 和 git pull
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12476239/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
git stash and git pull
提问by Lolly
I am new to Git and I am using EGit eclipse plugin to commit.
我是 Git 的新手,我正在使用 EGit eclipse 插件来提交。
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.
我修改了几个文件并隐藏了更改,然后我git pull
在命令行中执行了所有最新提交。然后我Apply stashed changes
从 EGit 做的。现在它应用了我的更改,并且从上次提交的隐藏文件中提取的更改消失了。我不知道为什么它没有询问我关于合并冲突的问题,并覆盖了我的更改并丢失了以前的提交更改。
How to get those changes?
如何获得这些变化?
回答by yilmazhuseyin
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