deep dive into git with team foundation server

61

Upload: dotruc

Post on 11-Feb-2017

238 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Deep dive into Git with Team Foundation Server
Page 2: Deep dive into Git with Team Foundation Server

Martin Woodward Edward ThomsonPrincipal Program Manager Senior Software Engineer

Deep dive into Git with Team Foundation Server

3-590

Page 3: Deep dive into Git with Team Foundation Server

[email protected]@martinwoodwardhttp://woodwardweb.comhttp://radiotfs.com

Martin Woodward

Page 4: Deep dive into Git with Team Foundation Server

tinyurl.com/proalm12

Page 5: Deep dive into Git with Team Foundation Server

[email protected]@ethomsonhttp://edwardthomson.com

Edward Thomson

Page 6: Deep dive into Git with Team Foundation Server
Page 7: Deep dive into Git with Team Foundation Server
Page 8: Deep dive into Git with Team Foundation Server
Page 9: Deep dive into Git with Team Foundation Server

We work hereand here

Page 10: Deep dive into Git with Team Foundation Server

A comprehensive ALM offeringTeam

Foundation Service

Planning SCM Work Item Tracking Continuous Deployment Build Automation Feedback

Management

Page 11: Deep dive into Git with Team Foundation Server

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

Page 12: Deep dive into Git with Team Foundation Server

Git fully integrated into Visual Studio and TFS

Page 13: Deep dive into Git with Team Foundation Server

Fully integratedGit support

Team Foundation Server/ServiceProject 2

Issues

Project

MgmtBuild

Git SCC Provider

Project 1

Issues

Project

MgmtBuild

Git

3rd Party XCodeEclipseShell

3rd Party Eclipse

Shell… TFVC

……

TFS SCC Provider

Team Explorer

TFVC Object Model

Local Repo

LibGit2 / LibGit2Sharp

Other Remote

Git Repo

Git-TF

Page 14: Deep dive into Git with Team Foundation Server
Page 15: Deep dive into Git with Team Foundation Server

Version control using Git with Visual Studio and TFSDemo

Page 16: Deep dive into Git with Team Foundation Server

Install Git for Windows Install PoshGit Install Windows Credential

Helper

Installing the perfect command linehttp://aka.ms/GitCL

Page 17: Deep dive into Git with Team Foundation Server

Pick the middle one:

Tip: Installing Git for Windowsfriends don’t let friends use Git bash…

Page 18: Deep dive into Git with Team Foundation Server

The Git repositoryDeep Dive

Page 19: Deep dive into Git with Team Foundation Server

History

1 2 3

1 2 3 4

5

My repository

Bob’s repository

5

6

Page 20: Deep dive into Git with Team Foundation Server

History is “flattened” to resemble output from regular git log

History in Visual Studio

Page 21: Deep dive into Git with Team Foundation Server

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

Page 22: Deep dive into Git with Team Foundation Server

CommitsContain meta-data

commit 4d2460a...

Parent commit: 6d36faa...

Author: Display Name <[email protected]> Timestamp

Committer: Display Name <[email protected]> Timestamp

Page 23: Deep dive into Git with Team Foundation Server

CommitsRepresent the entire repository

\file1.txt

blob feb8b81... file1.txt

tree 09fc4b44...

commit 4d2460a...

\file1.txt\file2.txt

blob 095ee29... file2.txt

blob feb8b81... file1.txt

tree 1a58993...

commit 6d36faa...

Page 24: Deep dive into Git with Team Foundation Server

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

Page 25: Deep dive into Git with Team Foundation Server

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

Page 26: Deep dive into Git with Team Foundation Server

CommitsDemo

Page 27: Deep dive into Git with Team Foundation Server

Author and Committer default to data in Git Settings:

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

Git Settings

Page 28: Deep dive into Git with Team Foundation Server

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

Best stored in the repo

Go to Git Settings in VS to create a default one

Ignoring stuff with .gitignore

Page 29: Deep dive into Git with Team Foundation Server

Git configuration can be stored in the repo and be path specific using .gitattributes

Commonly controls Which files are treated as binary Merge strategies Line ending conversion

Git Attributes

Page 30: Deep dive into Git with Team Foundation Server

git config --global core.autocrlf=true

A note on line endings

Page 31: Deep dive into Git with Team Foundation Server

Git does not track renames Commits are a snapshot of the entire repository No additional metadata about deltas between commits

Git guesses renames Compare deleted files to added files Similar files are deemed “renames”

Heuristic approach to renames is more accurate than relying on user input.

Renames

Page 32: Deep dive into Git with Team Foundation Server
Page 33: Deep dive into Git with Team Foundation Server
Page 34: Deep dive into Git with Team Foundation Server

Branches

4d2460a 6d36faa

fc1de8e

56b1b9f8b58f71aab6f14

bobs

mine

HEAD

Page 35: Deep dive into Git with Team Foundation Server

Branches

4d2460a 6d36faa

fc1de8e

56b1b9f8b58f71aab6f14

bobs

mine

HEAD

45dc20f

Page 36: Deep dive into Git with Team Foundation Server

BranchesDemo

Page 37: Deep dive into Git with Team Foundation Server

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

Page 38: Deep dive into Git with Team Foundation Server

MergesMerging two commits

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bobs

mine

HEAD

Page 39: Deep dive into Git with Team Foundation Server

MergesMerging two commits

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bobs

mine

HEAD

833831f

Page 40: Deep dive into Git with Team Foundation Server

MergesFast-forwards

4d2460a 6d36faa

fc1de8e

aab6f14

feature

master

HEAD

Page 41: Deep dive into Git with Team Foundation Server

MergesFast-forwards

4d2460a 6d36faa

fc1de8e

aab6f14

feature

master

HEAD

Page 42: Deep dive into Git with Team Foundation Server

Merging and dealing with conflicts in Visual StudioDemo

Page 43: Deep dive into Git with Team Foundation Server

Based on pack filesOnly 3 methods: info_refs: What are the current branch pointers? receive_pack: Push upload_pack: Fetch

Bottlenecks. Generally limited by client bandwidth

Git protocol

Page 44: Deep dive into Git with Team Foundation Server

TFS Git object data in SQLRepository Existence and Ownership

tbl_GitRepository (RepositoryId, Name, CreationDate, State, TeamProjectUri)

Git Ref Pointerstbl_GitRef (RepositoryId, Name, ObjectId, IsDefaultBranch)

Git Push Logtbl_GitPush (PushId, PusherId, PushTime)

Git Ref Logtbl_GitRefLog (PushId, Name, OldObjectId, NewObjectId)

Page 45: Deep dive into Git with Team Foundation Server

Stored in SQL for on-premises TFS

In Visual Studio Online, stored in Azure Blob storage

TFS Git object data in SQL/Azure BLOB

Page 46: Deep dive into Git with Team Foundation Server

Git is bad at certain things

Page 47: Deep dive into Git with Team Foundation Server

Reorganize data to answer path questions Done by a job that runs on each push UI works without data until it is available

Index things like author, committer, change typesCache is fully re-buildableLink to work items on push in a low pri job

TFS solution: Metadata cache in SQL

Page 48: Deep dive into Git with Team Foundation Server

Git is different Don’t force change on a team, give them choice Build out set of internal advocates and expertise via PoC’sCan use Git-TF or Git-SVN etc to migrate history Do you really need to migrate ALL history? Does the historical repo need to be the working one?If moving to Git, MOVE to GitFor large repos: Remove binary dependencies first (NuGet is your friend) Componentize code before migrating

Adopting Git

Page 49: Deep dive into Git with Team Foundation Server

Options for users to access Visual Studio Online3) New cloud-only monthly user

plans

2) Included for MSDN subscribers

Mix & match: pick the right MSDN subscription or user plan for each team member’s needs. New monthly user plans can be used to complement teams of MSDN subscribers.

Increased value to existing and new MSDN subscribers. User plans purchased via Windows Azure.

1) Completely free for small teams

FREE: 5 users.FREE: 60 minutes Cloud Build per month.

FREE: 5 users.Additional users $20/month.

All users $45/month.Max 10 per account with this plan.Includes use of the VS Pro IDE.All users $60/month.

Page 50: Deep dive into Git with Team Foundation Server

Choice in source code workflows Integrates the leading DVCS solution into the leading ALM suite Use centralized or distributed modes and always get the full integrated

ALM capabilities of TFS

Choice in development processes Pick Agile, CMMI, or Scrum processes or create your own Tooling to support best of breed practices regardless of your development

methodology

Choice in platforms Target the platform of your choice from the development environment of your

choice

Microsoft ALM supports choice

Page 51: Deep dive into Git with Team Foundation Server

[email protected]@microsoft.com@martinwoodward@ethomsonhttp://radiotfs.com

Thank you!

Page 52: Deep dive into Git with Team Foundation Server

for MSDN Ultimate subscribers

Go to http://msdn.Microsoft.com/specialoffers

SPECIAL OFFERSPartner Program

Page 53: Deep dive into Git with Team Foundation Server

Your Feedback is ImportantFill out an evaluation of this session and help shape future events. Scan the QR code to evaluate this session on your mobile device. You’ll also be entered into a daily prize drawing!

Page 54: Deep dive into Git with Team Foundation Server

© 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

Page 55: Deep dive into Git with Team Foundation Server

Exist at the repository level A tag applies to the entire repository Unlike most centralized version control tools where tags

contain a subset of the repository

Similar to branches. Implemented as a pointer to a commit in the grap Exist only in the local repository until they’re explicitly shared

Tags

Page 56: Deep dive into Git with Team Foundation Server

Tags

release-0.1

release-0.2

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bobs

mine

HEAD

833831f

Page 57: Deep dive into Git with Team Foundation Server

Tags

release-0.1

release-0.2

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bobs

833831f

mine

HEAD

7bcf452

Page 58: Deep dive into Git with Team Foundation Server

RebaseRebasing a commit

4d2460a 6d36faa

fc1de8e

8b58f71aab6f14

bob

mine

HEAD

Page 59: Deep dive into Git with Team Foundation Server

RebaseRebasing a commit

4d2460a 6d36faa

fc1de8e e4e1fb3

aab6f14

bob

mine

HEAD

Page 60: Deep dive into Git with Team Foundation Server

Sync with Visual StudioSync is the equivalent of: 1. fetch2. merge3. push

Page 61: Deep dive into Git with Team Foundation Server

“Pushed By” tracked by TFS