Git对Visual Studio的支持-将Git,TFS和VS放入上下文

VS loves Git

Dogs and cats, living together...mass hysteria. This classic Ghostbusters quote is used by many geek-types (myself included) whenever something crazy or unexplained happens.

狗和猫在一起生活……歇斯底里。 每当发生疯狂或无法解释的事件时,许多怪胎类型(包括我自己)都会使用这种经典的Ghostbusters报价。

Today Brian Harry from Microsoft announced Visual Studio 2012 Update 2 (or VS2012.2) the latest quarterly update. That's interesting, but it's the announcement of Git integration with Visual Studio and TFS that is really significant, in my opinion.

今天,来自微软的Brian Harry宣布了Visual Studio 2012 Update 2(或VS2012.2)的最新季度更新。 这很有趣,但是在看来,Git与Visual Studio和TFS集成的公告确实意义重大。

过去的TFS(TFS in the Past)

For me personally, the term "TFS" has historically meant "big scary corporate centralized source control" while Git has meant "small scrappy lightweight distributed source control." TFS meant connected (ZOMG, I can't code on a plane!) and Git meant occasionally connected (ZOMG, I don't know what rebase means!).

就我个人而言,“ TFS”一词在历史上的意思是“大型吓人的公司集中式源代码控制”,而Git的意思是“小而松散的轻量级分布式源代码控制”。 TFS表示已连接(ZOMG,我无法在飞机上编码!),而Git则意味着偶尔已连接(ZOMG,我不知道变基意味着什么!)。

However, I learned that Team Foundation Server (TFS) isn't just source control, it's a whole bug tracking, change management, application lifecycle management (ALM) suite. Source control is one pluggable piece.

但是,我了解到,Team Foundation Server(TFS)不仅是源代码控制,还包括整个错误跟踪,变更管理,应用程序生命周期管理(ALM)套件。 源代码控制是一个可插入的片段。

On the other hand, Git isn't just source control either. Git has become effectively FTP for code. I use Git to deploy most of my sites as mentioned in this blog post where have a site automatically deploy as I publish to GitHub. Git is also used as an interchange tool to move code between different SCMs, and it's supported everywhere, although Git tooling support on Windows has historically lagged behind.

另一方面,Git也不只是源代码控制。 Git已经有效地成为FTP的代码。本博客文章所述,我使用Git部署了我的大多数网站,其中有一个网站在我发布到GitHub时会自动部署。 Git还被用作在不同SCM之间移动代码的交换工具,尽管Windows上对Git工具的支持在历史上一直落后,但它在任何地方都受到支持。

Things start getting interesting if one could have Git as their source control with Team Foundation on the backend for ALM tools. Now Visual Studio 2012 supports both centralized version control and distributed version control in a cleanly integrated way.

如果可以将Git作为其在ALM工具后端的Team Foundation的源代码控制,事情就会变得很有趣。 现在,Visual Studio 2012以完全集成的方式支持集中版本控制和分布式版本控制。

开源-使用Git (Open Source - Working WITH Git)

So Visual Studio is integrating Git. Suspicious? This might sound like the "embrace and extinguish" Microsoft from the 90's. Arguments can always be made, but I'm a coder, so I look at the code.

因此,Visual Studio正在集成Git。 可疑? 这听起来像是90年代的“拥抱和扑灭”微软。 争论总是可以提出的,但是我是一名编码员,所以我看一下代码。

If you dig into the GitHub repo, you can see at least five Microsoft employees (phkelley, ethomson, jamill, martinwoodward, congyiwu) submitting pull requests to the libgit2 GPLv2 library (GPL'ed with a linking exception), including direct commits from phkelley who has earned that access. They work with all the libgit2 committers including Vicent Marti from GitHub. The team has been doing this for months and months. In fact, if anyone was paying attention to commits and pull requests they would have seen this whole convergence coming down Main Street.

如果您深入研究GitHub存储库,则可以看到至少五名Microsoft员工( phkelleyethomsonjamillmartinwoodwardcongyiwu )libgit2 GPLv2库(具有链接异常的GPL )提交拉取请求,包括phkelley的直接提交谁获得了该访问权限。 他们与所有libgit2提交者(包括来自GitHub的Vicent Marti)一起工作。 团队已经这样做了几个月和几个月。 实际上,如果有人关注提交和请求,他们会看到整个融合在Main Street发生。

 Libgit2 is a great library with a lot of attractive features (from their site):

Libgit2是一个很棒的库,具有很多吸引人的功能(来自其站点):

  • written in portable and standards compilant C

    用便携式和标准编译器C编写

  • completely multi-platform: Windows, Linux, Mac OS X, xBSD and more

    完全多平台:Windows,Linux,Mac OS X,xBSD等

  • compiled natively under all platforms (yes, even MSVC on Windows)

    在所有平台上本地编译(是的,甚至Windows上的MSVC)

  • re-entrant, with sane error handling

    重入,具有合理的错误处理

  • designed with a solid and consistent API

    使用可靠且一致的API设计

  • available as bindings for all major scripting language

    可作为所有主要脚本语言的绑定

You can see below that this new Visual Studio Git support actually ships git2 and libgit2sharp and integrates it via a VSIX (Visual Studio Extension).

您可以在下面看到,这个新的Visual Studio Git支持实际上附带了git2和libgit2sharp并通过VSIX(Visual Studio扩展)对其进行了集成。

git2 and libgit2sharp

Visual Studio和Git (Visual Studio and Git)

This Git support will require VS2012.2 (currently in preview) so you'll need to install that first, then get the VSIX. You'll be able to update both when VS2012.2 is released, and the Git VSIX will continue to update automatically via the VS Gallery. It's a full source code provider for VS so you can use it to do most anything without leaving VS, or you can hang out at the command line and use it for a visual reminder as to the state of your repository.

此Git支持将需要VS2012.2(当前处于预览状态),因此您需要先安装它,然后再获取VSIX。 当VS2012.2发布时,您将能够同时进行更新,并且Git VSIX将继续通过VS Gallery自动更新。 它是VS的完整源代码提供程序,因此您可以在不离开VS的情况下使用它执行大多数操作,或者可以在命令行中挂出并使用它来直观地提醒您存储库的状态。

One file added, one file modified

You can see what will be included in a commit and what's excluded:

您可以看到提交中将包含哪些内容,排除中包含哪些内容:

Commits to git, both included and excluded

You can make new branches, check them out, as well as see what branches are published or unpublished.

您可以创建新分支,将其签出,以及查看哪些分支已发布或未发布。

branching in Git in VS

In this screenshot you can can see Keith and I going back and forth on a Pull Request. Note that I've allowed VS in Git Settings to go to Gravatar and get a picture of Keith.

在此屏幕截图中,您可以看到Keith和我在请求请求中来回走动。 请注意,我已经允许Git Settings中的VS转到Gravatar并获取Keith的图片。

Git History and Gravatars in VS

Here's a screenshot of me managing a recent merge conflict with the VS diff editor then committing the change and pushing it to GitHub. All the diffing is integrated as you'd expect it to be, and available via a Right-Click.

这是我与VS diff编辑器管理最近合并冲突,然后提交更改并将其推送到GitHub的屏幕快照。 所有差异都已按照您的期望进行了集成,并且可以通过右键单击来使用。

下一步是什么? (What's next?)

I'm told that while this Git integration is currently in preview. The team work on a three week sprint cadence so expect to see frequent updates.  The plan is that in a future release Git will come baked in to all editions of Visual Studio - including Express. Perhaps we'll see PoshGit command line integration/support and maybe better support for the Git command line within the NuGet Package Manager Console inside VS.

有人告诉我,虽然此Git集成当前处于预览状态。 团队需要进行为期三周的冲刺节奏,因此希望能经常看到更新。 该计划是,在将来的版本中,Git将被引入到Visual Studio的所有版本中,包括Express。 也许我们会看到PoshGit命令行集成/支持,也许会在VS内的NuGet软件包管理器控制台中获得对Git命令行的更好支持。

Git within the NuGet Package Manager Console

托管团队基础服务-GitTF版本控制 (Hosted Team Foundatation Services - Git or TF Version Control)

You can use VS Git support with all your Git projects by just opening projects. It's just Git. I am pushing branches to CodePlex, to GitHub and other Git repos. I'm also continuing to use my other Git tools interchangeably, as I like.

您只需打开项目即可对所有Git项目使用VS Git支持。 只是Git。 我正在将分支推到CodePlex,GitHub和其他Git仓库。 我还喜欢继续交替使用其他Git工具。

Some teams I work on use Git, others  use TFS. It depends on the team, the company and the goals. Some teams have servers they run themselves, some use hosted Git services at BitBucket or GitHub. There's also hosted Team Foundation Services.

我工作的一些团队使用Git,其他团队使用TFS。 这取决于团队,公司和目标。 有些团队拥有自己运行的服务器,有些则使用BitBucket或GitHub上托管的Git服务。 还托管了Team Foundation Services。

For teams, you can go up to http://tfs.visualstudio.com and sign up for a account and get 5 users for free. You can choose either Git or Team Foundation Version Control (TFVC) as the source provider and use all the Team Foundation agile, scrum or other templates for your ALM tools. I've actually got https://hanselman.visualstudio.com now for my "team." There's issue tracking, backlogs, scrum templates, a Kanban board, burndown charts and more. You can use the web app or use the Visual Studio integration to manage your bugs and backlog. There's even cloud build servers in preview.

对于团队,您可以访问http://tfs.visualstudio.com并注册一个帐户,免费获得5个用户。 您可以选择的Git或Team Foundation版本控制(TFVC)作为源提供者,并使用所有的Team Foundation敏捷,争球或其他模板供您ALM工具。 实际上,我的“团队”现在拥有https://hanselman.visualstudio.com 。 有问题跟踪,积压,scrum模板,看板,燃尽图等。 您可以使用Web应用程序或使用Visual Studio集成来管理错误和积压。 甚至还有预览中的云构建服务器

TFS online kanban

I've said this before, but I'll say it again. This kind of open source collaboration stuff is why I went to work for The Man. Playing well with others, competing well while using and promoting open source. I don't think every group at Microsoft "gets" it yet, but it's cool to see the open movement spreading. I'm looking forward to using these Git tools for Visual Studio, as well as GitHub for Windows and PoshGit.

我之前已经说过,但我会再说一遍。 这种开源协作的东西就是我去The Man工作的原因。 与他人一起玩,在使用和推广开源时进行良好竞争。 我不认为微软的每个团队都“了解”它,但是看到开放运动正在传播很酷。 我期待将这些Git工具用于Visual Studio,并将GitHub用于Windows和PoshGit

翻译自: https://www.hanselman.com/blog/git-support-for-visual-studio-git-tfs-and-vs-put-into-context

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值