[email protected] @martinwoodward

59

Upload: charla-may-clarke

Post on 19-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

Martin Woodward Phil HaackPrincipal Program Manager Engineering ManagerMicrosoft GitHub

Using Git in Visual Studio

3-746

[email protected]

@martinwoodward

http://woodwardweb.com

http://radiotfs.com

Martin Woodward

Practices VisibilityGovernanceMentorshipSupportFeedback

MediaEventsSponsorship

Fostering a vibrant .NET ecosystem

ProtectionLicensesCopyrightsTrademarksPatents

dotnetfoundation.org

dotnet.github.io

@dotnetfdn

98 repositories13,189 forks2,290 contributors

Growing daily…

Openness.

Community.

Rapid innovation.

Openness

Community

Rapid innovation

The .NET Foundation

.NET API for Hadoop WebClient

.NET Compiler Platform ("Roslyn").NET Map Reduce API for Hadoop

.NET Micro Framework

ASP.NET MVCASP.NET Web API

ASP.NET Web Pages

ASP.NET SignalR

MVVM Light Toolkit

.NET Core 5

Orleans

MEF (Managed Extensibility Framework)

OWIN Authentication MiddlewareRx (Reactive Extensions)

Orchard CMSWindows Azure .NET SDK

Thinktecture IdentityManagerWnsRecipe

Mimekit Xamarin.Auth

Xamarin.Mobile

Couchbase for .NET

Meet the people behind the .NET Foundationhttp://www.dotnetfoundation.org/team

Join the conversation with the

community http://www.dotnetfoundation.org @dotnetfdn

Mailkit

System.Drawing

ASP.NET 5

Salesforce Toolkits for .NET

NuGetKudu Cecil

MSBuild

LLILC

tinyurl.com/proalm12

Phil Haack, GitHub

@haacked

Git fully integrated into Visual Studio, Visual Studio Online and TFS

Announcing…

GitHub fully integrated into Visual Studio 2015

Centralized Version Control

(TFVC)

Strengths Best for

Modern source-control approaches

Server Workspaces

Local Workspaces

DistributedVersion Control (Git)

• Scales to very large codebases

• Fine level permission control

• Allows usage monitoring

• Large integrated codebases

• Control and auditability over source code down to the file level

• Offline editing support

• Easy to edit files outside Visual Studio or Eclipse

• Medium-sized integrated codebases

• A balance of fine-grained control with reduced friction

• Full offline experience

• Complete repository with portable history

• Simplified branching model

• Modular codebases

• Integrating with open source

• Highly distributed teams

Version control using Git with Visual StudioDemo

The Git repositoryDeep Dive

History

1 2 3

1 2 3 4

5

My repository

Bob’s repository

5

6

How are commit IDs generated?• Can’t be monotonically increasing without a server to arbitrate• A cryptographic hash (SHA1) of the contents of the commit

History

1 2 3 4

5

64d2460a 6d36faa

fc1de8e

56b1b9f8b58f71aab6f14

History Improvements in VS2015Demo

Commits are immutable• Since they are the hash of the contents, changing the content changes

the hash• Create a new commit that contains the old data and the modifications

Commit amend• Updates only the latest commit

Dangerous if you have published commits• Other users are making changes based on that commit

Rewriting history

You can remove the ability to “force push” to TFSRestricting ability to push history re-writes

Author and Committer default data in Git Settings:

git config --global user.name “Martin Woodward“ git config --global user.email “[email protected]"

Git Settings

.gitignore file specifies which files get ignored from the repo by default

Best stored in the repo

Go to Git Repository Settings in Team Explorer to create a default one

Ignoring stuff with .gitignore

CommitsDemo

Branches

4d2460a 6d36faa

fc1de8e

56b1b9f8b58f71aab6f14

bobs

mine

HEAD

Branches

4d2460a 6d36faa

fc1de8e

56b1b9f8b58f71aab6f14

bobs

mine

HEAD

45dc20f

Exist at the repository level• A branch applies to the entire repository• Unlike most centralized version control tools where branches

exist inside the repository

Exceptionally lightweight• Implemented as a pointer to a commit in the graph• Exist only in the local repository until they’re explicitly shared• Encourages feature branching

Branches

Tags

release-0.1

release-0.2

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bobs

mine

HEAD

833831f

Tags

release-0.1

release-0.2

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bobs

833831f

mine

HEAD

7bcf452

Branches & TagsDemo

MergesMerging two commits

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bobs

mine

HEAD

MergesMerging two commits

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bobs

mine

HEAD

833831f

MergesFast-forwards

4d2460a 6d36faa

fc1de8e

aab6f14

feature

master

HEAD

MergesFast-forwards

4d2460a 6d36faa

fc1de8e

aab6f14

feature

master

HEAD

RebaseRebasing a commit

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bob

mine

HEAD

fc1de8e

RebaseRebasing a commit

4d2460a 6d36faa 8b58f71aab6f14

mine

HEAD

9cd3f8e

bob

4a1defe

RebaseRebasing a commit

4d2460a 6d36faa 8b58f71aab6f14

mine

HEAD

6cdf32a

bob

b9d3fe1

Merge, Rebase and dealing with conflicts in Visual Studio

Demo

Feature Branches and Pull Requests

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

my-feature

master

HEAD

Feature Branches and Pull RequestsMerge via Pull Request

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

my-feature

master

HEAD

833831f

PR12

• Use feature branches in a shared private repo

• Only merge to master via Pull Requests• Consider use of Code Policies with Pull

Requests

Working in a larger team

Using Pull Requests in Visual Studio OnlineDemo

http://langpop.corger.nl/

GitHub fully integrated into Visual Studio 2015

• Limited push access to shared repo• Fork the shared repo• Commit changes into Feature Branch• Create pull request

• Good practise for the committers of a large project to follow same workflow

Open Source Workflow

Using the Fork and Pull Request model

dotnet\coreClr

phil\coreClr

Installation

https://aka.ms/ghfvs

Installation

Installation

Using GitHub with Visual Studio 2015

Demo

What’s new for Git in VS 2015• 1st Class GitHub Integration (+ extensibility)• Git for Windows installed by default (RTM)• History Enhancements• Branch Enhancements• Rebase Support• Remotes management• Git Settings Enhancements• Performance (esp clone, checkout, fetch,

merge)

What’s new for Git in TFS 2015• Code Policies• Required Build (Gated Pull Request)• Minimum number of reviewers, specific code reviews based on file path

• Pull Requests• Integration with policies & builds• Lightweight States + Voting Enhancements

• Web Based File Editing• New History View (including Branch

Updates)• Team Project Rename• Performance

• Fill out your evals• Install VS 2015 RC today• Have a play with Git• Create a VSO Account• Create a GitHub Account• Contribute some code to an OSS project

Call to Action

Martin [email protected]@martinwoodward

Phil [email protected]@haacked

Thank you

© 2015 Microsoft Corporation. All rights reserved.