Visual Studio 2013,Git和Shelving

编程入门 行业动态 更新时间:2024-10-23 08:27:59
本文介绍了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

本文发布于:2023-11-07 06:29:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565771.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Studio   Visual   Shelving   Git

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!