git 拉动后如何取回藏匿处
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41188489/
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
how to get the stash back after pulling
提问by farm command
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
昨天我做了主分支的一些变化,但并没有承诺他们,今天我试图把主人,但它说我必须提交或藏匿我改变Please, commit your changes or stash them before you can merge.
我藏匿他们git stash
,然后从主拉git pull
我现在已经做了一些变化,我代码,但发现应该完成存储,我不得不提交更改。现在我能做什么
1) the changes from stash back
1) 从 stash back 的变化
2) what I got from git pull
2)我得到了什么 git pull
3) and my current changes
3)和我目前的变化
I found this post herebut 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.
我在这里找到了这篇文章,但这个人没有从 master 那里拉出来,所以我不确定那里的答案对我有用,也不能真正冒险并像在 master 上那样尝试。
回答by Vampire
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.
只需使用git stash pop
或git stash apply
。只要隐藏的更改与您拉取或编辑的内容不冲突,它就会起作用,否则您会遇到一些合并冲突,您可以像执行合并或变基一样解决这些冲突。
回答by Sajib Khan
$ git stash list # see stash list(s)
$ git stash apply # default take the top one 'stash@{0}'
$ git stash pop # pop = apply + drop, take the top stash changes then delete it
$ git stash apply stash@{1} # get back number 2 stash changes