[email protected] @martinwoodward
TRANSCRIPT
Martin Woodward Phil HaackPrincipal Program Manager Engineering ManagerMicrosoft GitHub
Using Git in Visual Studio
3-746
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
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
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
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
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
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
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
• 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
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