使用Visual Studio部分暂存文件 [英] Partially stage files with Visual Studio

查看:264
本文介绍了使用Visual Studio部分暂存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有什么方法可以将代码段而不是整个文件暂存?

Is there any way to just stage pieces of code in a file instead of the whole file?

只是想知道这是否可能.

Just wondering if this is possible.

使用Visual Studio 2015,TFS 2015(Git).

Using Visual Studio 2015, TFS 2015 (Git).

推荐答案

否,Visual Studio 2015和2017都不支持暂存块(部分文件).您需要使用其他客户端来进行这些部分更改.

No, neither Visual Studio 2015 nor 2017 support staging hunks (partial files). You'll need to use another client to stage these partial changes.

暂存大块是一项客户端功能,任何支持该功能的客户端都可以用于暂存大块.命令行或Tower或SourceTree之类的第三方客户端都可以.暂存后,可以使用Visual Studio或任何其他可以提交更改的客户端(几乎是每个git客户端)来提交已暂存的更改.

Staging hunks is a client feature, any client that supports it can be used to stage a hunk. The command line or a 3rd party client like Tower or SourceTree will do. Once staged, committing the staged changes can be done using Visual Studio or any other client that can commit changes (that would be pretty much every git client out there).

暂存一个大块后,Visual Studio会将文件显示为暂存",也显示为未暂存".暂存的文件包含您暂存的块.未暂存的文件包含您尚未暂存的块.当您提交分阶段的块时,将被提交.您可以根据需要重复此循环多次.

Once a hunk is staged, Visual Studio will show the file as "Staged" and also as "Unstaged". The staged file contains the hunk you staged. The unstaged file contains the hunks you haven't staged. When you commit the staged hunk(s) will be committed. You can repeat this cycle as many times as you want.

这篇关于使用Visual Studio部分暂存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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