如何在Visual Studio 2013中存储未提交的更改 [英] How do I stash uncommitted changes in Visual Studio 2013

查看:187
本文介绍了如何在Visual Studio 2013中存储未提交的更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要有关如何使用Visual Studio 2013搁置Git存储库中未提交的更改的帮助.我来自PHPStorm,您可以在其中搁置一个分支上的未提交更改,切换到另一个分支并搁置.

Need some help on how I can shelve uncommited changes in a Git repository using Visual Studio 2013. I come from PHPStorm where you can shelve uncommited changes on one branch, switch to another and unshelve.

但是,我找不到/看不到如何在Visual Studio中完成此操作.有人可以阐明这个问题吗?

However, I can't find/see how this can be done in Visual Studio. Could someone shed some light on this issue?

只是为了阐明为什么可能需要这样做:我可能正在分支X上工作,然后确定我是错误的分支,而我应该在分支Y上.我需要搁置分支X的所有更改,切换到分支是的,取消搁置更改,然后提交.

Just to clarify why this may be needed: I might be working on branch X, and then figure that I am the wrong branch and I should be on branch Y. I need to shelve all changes from branch X, switch to branch Y, unshelve changes and then commit.

谢谢.

推荐答案

git中,您要查找的概念是stash.您添加更改,就好像要提交更改一样,然后使用git stash存储它们.更改分支后,您可以git stash applygit stash pop(前者将存储区留作重用).

In git the concept you're looking for is stash. You add your changes as if you are going to commit them, and you then stash them with git stash. After changing branches, you can git stash apply or git stash pop (with the former leaving the stash available for reuse).

我熟悉Perforce的shelf概念,它与Git的存储有很大的不同-您可以将一个架子发送到服务器并与其他人共享,而使用git则不能.但是,使用git可以只创建带有存储的分支并将其推送到服务器,从而允许其他人将其合并到需要的地方.

I'm familiar with the shelf concept from Perforce, which has a useful difference from Git's stash -- where you can send a shelf to the server and share it with other people, you cannot do that with git. However, with git you can just create a branch with the stash and push that to the server, allowing others to merge it where it's needed.

Microsoft没有提供使用此功能的方法.

Microsoft does not provide a way to use this feature.

这篇关于如何在Visual Studio 2013中存储未提交的更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆