git stash questions

守給你的承諾、 提交于 2019-12-05 01:30:19

问题


I am running msysgit 1.7.3.1. If I run stash apply, and there is a conflict, all of my stash changes get staged. Is this the correct behaviour? I found it a little surprising.

Another question: if I have stashed 10 files, and there is a conflict in one of them, will stash apply abort when it has a conflict, or will it apply all non-conflicted files.

Finally, if I do the following:

git stash
git pull
git stash apply

and another developer has removed a file that I have stashed, then I am unable to apply the stash on this file. How can I retrieve my changes from the stash?

Thanks!


回答1:


the index is used to indicate that these files did not have conflicts. Your conflicted files should not be in the index.

re the 10 files. Stash will add the remaining 9 to the index. Fix the conflict in the remaining file. Add it to the index. Then commit.

re the changes from the stash that are missing. You can get your file by doing a git checkout (stash-SHA1 or other reference to it>) -- filespecification

you can also change your stash to a branch which you then can checkout and do more things with.

hope this helps



来源:https://stackoverflow.com/questions/3945826/git-stash-questions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!