好得很程序员自学网
  • 首页
  • 后端语言
    • C#
    • PHP
    • Python
    • java
    • Golang
    • ASP.NET
  • 前端开发
    • Angular
    • react框架
    • LayUi开发
    • javascript
    • HTML与HTML5
    • CSS与CSS3
    • jQuery
    • Bootstrap
    • NodeJS
    • Vue与小程序技术
    • Photoshop
  • 数据库技术
    • MSSQL
    • MYSQL
    • Redis
    • MongoDB
    • Oracle
    • PostgreSQL
    • Sqlite
    • 数据库基础
    • 数据库排错
  • CMS系统
    • HDHCMS
    • WordPress
    • Dedecms
    • PhpCms
    • 帝国CMS
    • ThinkPHP
    • Discuz
    • ZBlog
    • ECSHOP
  • 高手进阶
    • Android技术
    • 正则表达式
    • 数据结构与算法
  • 系统运维
    • Windows
    • apache
    • 服务器排错
    • 网站安全
    • nginx
    • linux系统
    • MacOS
  • 学习教程
    • 前端脚本教程
    • HTML与CSS 教程
    • 脚本语言教程
    • 数据库教程
    • 应用系统教程
  • 新技术
  • 编程导航
    • 区块链
    • IT资讯
    • 设计灵感
    • 建站资源
    • 开发团队
    • 程序社区
    • 图标图库
    • 图形动效
    • IDE环境
    • 在线工具
    • 调试测试
    • Node开发
    • 游戏框架
    • CSS库
    • Jquery插件
    • Js插件
    • Web框架
    • 移动端框架
    • 模块管理
    • 开发社区
    • 在线课堂
    • 框架类库
    • 项目托管
    • 云服务

当前位置:首页>高手进阶
<tfoot draggable='sEl'></tfoot>

Visual Studio ALM + Team Foundation Server Blog

Visual Studio ALM + Team Foundation Server Blog

Visual Studio ALM + Team Foundation Server Blog http://blogs.msdn.com/b/visualstudioalm/archive/2013/01/30/getting-started-with-git-in-visual-studio-and-team-foundation-service.asp Executive Bloggers http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c --------------------------------------------------------------------------------------------- Visual Studio Application Lifecycle Management Languages .NET Framework Platform Development

Visual Studio ALM + Team Foundation Server Blog

Bringing you news, technical articles, and other useful content about Visual Studio ALM and Team Foundation Server

Getting Started with Git in Visual Studio and Team Foundation Service

RATE THIS

Andy Lewis - MSFT

30 Jan 2013 8:49 AM

47

By  Matthew Mitrik (MS) ,  Andy Lewis , and  Martin Woodward

Today we  announced  the availability of Git for Visual Studio and Team Foundation Service. In this post, we'll walk through the new experiences.

Get set up:   Get the free service , and then you can use it with any Git client tools you want, including Visual Studio. To use the Visual Studio client tools you'll need to  install Visual Studio 2012 ,  apply Visual Studio 2012 Update 2 CTP , and finally  install Visual Studio Tools for Git . You can use these client tools with any Git service you want.

Choose between TFVC and Git

With this announcement, each time you create a new team project we give you a choice: Team Foundation Version Control (TFVC) or Git? The best option for you depends on a lot of factors, including size of codebase, team size, and team distribution to name a few. Now that Git is fully integrated with TFS, the decision depends solely on what your team needs from version control. Looking at the strengths and features of each system can help make the decision easier.

Team Foundation Version Control (TFVC)

TFVC is a centralized version control system. While it works well for small teams with small code bases, TFVC is capable of scaling to support very large codebases (millions of files per branch with server workspaces) and it handles large binary files well. TFVC provides very granular permission control, allowing teams to restrict access down to a file level if needed. Since all contributions are checked in to the central server, it is very easy to audit changes and identify exactly which user committed a given code change.

Learn more about TFVC on  MSDN .

Git

Git is a distributed version control system where each developer has a copy of the entire source repository. Having a local repository means that Git works well in environments where developers need to work without connectivity. It also offers a simple branching model that enables developers to quickly create local and private branches, enabling flexible workflows. Git also works well in modular codebases where code is distributed across many repositories.

Learn more about Git on the official Git site:  http://git-scm.com/documentation

Ultimately, much of the decision about which version control system to use is about preference. Both systems are equally capable for the majority of teams. Make sure your team is happy with the version control system you choose.

Create a Git team project in Team Foundation Service

You can quickly spin up a new Git team project with just a few clicks.

 

In the next section we'll tell you more about how to connect to your new team project from VS. Also, we'll talk about another option you have to begin from your local dev machine instead of from a team project.

  Use Visual Studio with Git

Git provides powerful DVCS features that enable your team to collaborate on an app. But Git's user interface can be difficult to use, and to get full value from it you may need to bring separate tools together. Visual Studio provides an integrated experience that makes it easy for your team to leverage the power of Git. And if you are a Git pro who has some favorite Git tools you still want to use, you can use them alongside Visual Studio.

If your Git repository is in a TFS team project, you get additional benefits from the integration with other TFS features such as work items.  But even if you are not using TFS, you can use Visual Studio with Git to work on a completely local repository, or to collaborate using Git hosters such as GitHub and BitBucket.

To get going, connect and clone

When you are ready to begin working in your Git team project, you begin by connecting to it. Once you've connected to your new Git project, you'll be prompted to Clone the repository in the team project onto your dev machine.

 

After you cloned from a Git team project, you will have two entries for this codebase, one under Team Foundation Service and one under Local Git Repositories.

You can also use the tools to clone from any hosted Git repository.

Or, just start coding locally

Maybe one of the coolest features of Visual Studio with Git is that in just a few seconds, you can be writing code on a new project under local version control. Want to try it? You can  create a new code project  in a new local Git repository in less than a minute:

You can continue coding and committing locally for as long as you like. When you are ready to share and collaborate, just publish your code into TFS , or into whatever Git service your team uses (e.g. CodePlex, GitHub, Bitbucket).

Customize your settings

Git associates each commit you create with your name and email address. When you first begin using Visual Studio with Git on your dev machine, if you begin by cloning from a Git team project, then Visual Studio fills these in for you.

You can override the name and email settings and specify other settings.

Enable download of author images from 3rd party source : Visual Studio can display author images on commits.  By default it uses the image in the user's TFS profile. If the user doesn't have an image set, an image from  Gravatar  will be used.

Ignore File : To avoid checking in temporary non-source items such as binaries, you can specify a .gitignore file. See Ignoring files  and  gitignore(5) Manual Page .

Attributes File : To specify options such as how the system handles line-breaks, you can specify a .gitattributes file. See Customizing Git - Git Attributes .

For more information on Git settings, see  Customizing Git - Git Configuration .

Commit changes locally

As you write your code, you can commit to create a snapshot of your changes on your dev machine as often as you like. You can associate a work item with your commit by specifying its id in the comment. 

 

Later when you push your local repository to the Git team project, the commit will be associated with work item 255. In TFS you can also associate a work item with a commit after it has been pushed using the Links tab in the work item.

Pull

To ensure your code integrates well with the latest code from the team, you should pull changes on a regular basis. Also, if there are any changes in the remote branch, you must pull them before you can push.

Before you pull, you can fetch to see what changes are coming.

When you are ready to take the changes, pull them.

For step-by-step instructions, see  Pull changes from the team .

Push

When you are ready to push the changes in your selected branch, just click Push.

 

For step-by-step instructions, see  Push your changes .

Create and use branches

Git branches differ from TFVC branches in a few ways. Git branches are local (and thus private) until pushed. They are also more lightweight, so you can quickly create a branch on your dev machine whenever you need one.

 

You can switch the branch you are working in from Changes and Commits pages.

When you are ready, you merge to combine the work.

 

For more details on how branches work in Git, see  Git Branching .

Resolve conflicts

Sometimes you will need to resolve conflicts before you can complete a pull or a merge.

Visual Studio makes it easy for you to resolve some of the most common kinds of conflicts, such as content conflicts.

 

Some conflicts (such as rename conflicts) must be resolved using a command-line tool such as  Msysgit .

View History

You can view the history of an item from Solution Explorer or from the Changes page. You can also view the history of an entire branch from the Branches page.

Web Access

After commits have been pushed into the repo, the Code hub starts to look a lot more interesting.

Explorer view

The Explorer view is the center of the browse experience in the web. You can drill in to the contents of a repository and see the commit message and author of the latest changes to each folder and file.

History

As you're exploring the repo, you can easily switch to the History view to view the history of a file or folder. The history view is a similar to the VS view, providing the comment, author, and time of the commit. Off to the left is an indicator showing relative size of each commit.

Compare files

Using the Compare view, you can compare versions of a file in either a side-by-side or inline diff view, complete with syntax highlighting.

Commits view

To see an all-up view of the repo history, use the commits view. By default, the view shows all changes, but you can filter to view just your commits, or use the Advanced search to filter down the list by author, path, and/or date.

Commit Details

Drilling in on a commit shows the detailed metadata for the commit, including associated work items. Each file modified in the commit is also shown with an inline diff to summarize the changes.

Pivot on branch or tag

In any of the views in the Code hub, the branch selector may be used to pivot the entire repo view by branch. If you've pushed any tags to the repo, they'll be shown in the same picker.

Xcode

Developers using Xcode will be able to use the existing Git integration to work with repos hosted in Team Foundation Service. Be sure to  enable alternate credentials  (basic auth) for your TF Service user profile before trying to push and pull from Xcode (or any other third party Git client for that matter). Note that you can get the clone URL from the Explore view in the project's web portal.

Team Foundation Build and Git

The cloud build service can be used to build Git projects much like you can build TFVC projects.

Configure a manual build

Configuring a build for Git projects is similar to configuring TFVC builds. You can start by clicking New Build Definition in the Builds page in Team Explorer.

In the build definition editor, give your build a name and a description. On the process page specify the branch you want to build and the relative path to the solution file to build. Note that only the manual trigger is currently available, but we're working on adding more.

Queue a new build from the Builds page. Remember, you need to push your commits to the service in order to build them.

Build report

After the build has completed, the build report shows that the build succeeded.

Next steps

Downloads Sign up for a TFS account Visual Studio 2012 Visual Studio 2012 Update 2 CTP Visual Studio Tools for Git

More information Learn on the Welcome Portal Git documentations http://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c

作者: Leo_wl

    

出处: http://www.cnblogs.com/Leo_wl/

    

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

版权信息

查看更多关于Visual Studio ALM + Team Foundation Server Blog的详细内容...

声明:本文来自网络,不代表【好得很程序员自学网】立场,转载请注明出处:http://haodehen.cn/did45906

更新时间:2022-09-24   阅读:46次

上一篇: 通过分析内存来优化.NET程序

下一篇:BarCode条形码基于C# GDI+ 的实现

相关资讯

最新资料更新

  • 1.文心一言 VS 讯飞星火 VS chatgpt (92)-- 算法导论8.3 5题
  • 2.算法学习笔记(2): 逆元及其应用
  • 3.【LeetCode】三数之和+四数之和(双指针)
  • 4.MD5算法——C++实现
  • 5.算法总结--ST表
  • 6.图解 LeetCode 算法汇总——回溯
  • 7.vivo 故障定位平台的探索与实践
  • 8.FIFO算法,LRU算法,OPT算法,LFU算法的C++实现
  • 9.算法 识别有效ip地址和掩码并做统计
  • 10.七大查找常见算法
  • 11.精华推荐 |【算法数据结构专题】[延时队列算法]史上非常详细分析和介绍如何通过时间轮(TimingW
  • 12.C++ 算法竞赛、02 周赛篇 | AcWing 第2场周赛
  • 13.《算法导论》笔记 第9章 9.3最坏情况线性时间选择
  • 14.C语言堆排序经典算法TopK问题解析
  • 15.【LeetCode动态规划#06】分割等和子集(01背包问题一维写法实战)
  • 16.Python利用Prim算法生成迷宫
  • 17.深度解读Python如何实现dbscan算法
  • 18.CF构造题1600-1800(1)
  • 19.Java实现常见查找算法
  • 20.四个Java必须知道的负载均衡算法分享

CopyRight:2016-2025好得很程序员自学网 备案ICP:湘ICP备09009000号-16 http://haodehen.cn
本站资讯不构成任何建议,仅限于个人分享,参考须谨慎!
本网站对有关资料所引致的错误、不确或遗漏,概不负任何法律责任。
本网站刊载的所有内容(包括但不仅限文字、图片、LOGO、音频、视频、软件、程序等)版权归原作者所有。任何单位或个人认为本网站中的内容可能涉嫌侵犯其知识产权或存在不实内容时,请及时通知本站,予以删除。

网站内容来源于网络分享,如有侵权发邮箱到:kenbest@126.com,收到邮件我们会即时下线处理。
网站框架支持:HDHCMS   51LA统计 百度统计
Copyright © 2018-2025 「好得很程序员自学网」
[ SiteMap ]