[英]How can one in Visual Studio open another GIT-branch without need to commit changes to the current one?
How do one use multiple branches or switch branch without commit? 如何使用多个分支或切换分支而不提交?
I'm using GIT with VisualStudio and are working in one branch when a colleague of mine ask me to to something in another. 我正在使用GIT与VisualStudio,当我的一位同事让我去另一个分支时,我正在一个分支机构工作。 I do not want to commit changes in my first branch.
我不想在我的第一个分支中提交更改。 How do I use two branches simultaneously or how do I switch branches without committing pending changes?
如何同时使用两个分支或如何在不提交挂起更改的情况下切换分支?
When you have uncommitted changes in a branch and you want to switch to another branch you can use git stash
to temporarily "save" the changes without committing them. 如果您在分支中有未提交的更改并且想要切换到另一个分支,则可以使用
git stash
临时“保存”更改而不提交更改。
When you switch back to the branch you can use git stash pop
to reapply your changes to the branch. 当您切换回分支时,您可以使用
git stash pop
将更改重新应用于分支。
You can also do more advanced stuff with stash, see the Git Pro book Chapter about it for more. 您还可以使用stash执行更高级的操作,有关详细信息,请参阅Git Pro相关章节。
If you are using Visual Studio 2019 you can stash directly in the Team Explorer , for the 2017 version you can use this extension if you don't want to use the terminal. 如果您使用的是Visual Studio 2019,则可以直接在团队资源管理器中存储,对于2017版本,如果您不想使用终端,则可以使用此扩展 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.