简体   繁体   English

如何在Visual Studio中打开另一个GIT分支而无需提交对当前的更改?

[英]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.

相关问题 git:如何将更改添加并提交到一个远程分支,而不提交到另一个? - git: how to add and commit changes to one remote branch but not another? git从一个分支切换到另一个分支,但不对当前分支进行更改 - git switch from one branch to another without carrying the changes in the current branch 通过特定的提交隔离git从一个分支到另一个分支的更改 - Isolate git changes from one branch to another by specific commit git 将更改从一个提交应用到另一个分支 - git apply changes from one commit onto another branch 在git中将更改从一个分支更改为另一个分支,以及如何在自己的分支上工作 - Get changes from one branch into another one in git and how can I work on my own branch 如何从一个git分支更改到另一个分支 - How to take changes from one git branch to another branch 如何通过git将更改从一个分支拉到另一个分支 - How to pull changes from one branch to another branch through git 如何将更改从一个分支移动到另一个分支 git? - How to move the changes from one branch to another branch git? 如何在Visual Studio团队资源管理器中一次性接受多个文件中的Git分支合并更改? - How do I accept Git branch merge changes in multiple files in one go in Visual Studio Team Explorer? 如何在git中将提交从一个分支复制到另一个分支而不进行任何合并? - How to copy a commit from one branch to another in git without any merging?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM