Visual Studio 2013,Git和Shelving [英] Visual Studio 2013, Git and Shelving

查看:121
本文介绍了Visual Studio 2013,Git和Shelving的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要一些帮助,了解如何使用Visual Studio 2013在Git存储库中搁置未经修改的更改。我来自PHPStorm,您可以在其中一个分支上搁置未经更改的更改,切换到另一个分支并取消搁置。



然而,我无法在Visual Studio中找到/了解如何完成这项工作。有人可以解释一下这个问题吗?



只是为了澄清为什么可能需要这样做:我可能正在研究分支X,然后认为我是错误的分支我应该在分支Y上。我需要搁置分支X的所有更改,切换到分支Y,取消搁置更改并提交。



谢谢。

解决方案在 git 中,您要查找的概念是藏匿。你添加你的改变,就像你要提交它们一样,然后你用 git stash 来存储它们。更改分支之后,可以使用 git stash apply git stash pop (前者允许重复使用该存储) 。



我熟悉Perforce的架构概念,它与Git的存储有很大的区别 - 在这里你可以发送一个书架到服务器并与其他人共享,你不能用git来完成。但是,通过git,您可以创建一个存储分支并将其推送到服务器,从而允许其他人将其合并到需要的地方。



Microsoft不提供方法使用此功能。


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.

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

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.

Thanks.

解决方案

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).

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 does not provide a way to use this feature.

这篇关于Visual Studio 2013,Git和Shelving的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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