DEV302. Licensed under Creative Commons from Centralized Version Control.

43
Using Git with Visual Studio 2013 Rob Maher DEV302

Transcript of DEV302. Licensed under Creative Commons from Centralized Version Control.

Using Git with Visual Studio 2013

Rob Maher DEV302

[email protected]@scrumdodwww.robmaherconsulting.co.nz/

Rob Maher

Agenda

What is Git? / Why should I use it?Git with Visual StudioGit workflowsCool stuff

A little history..

Centralized Version Control

Server workspaces

Licensed under Creative Commons from https://www.flickr.com/photos/police_mad_liam/4311770592

Centralized Version Control

Centralized Version Control

Local workspaces

Licensed under Creative Commons from https://www.flickr.com/photos/swanksalot/4839095305

Local Workspaces

Distributed Version Control

Remember this?

Or this…

Licensed under Creative Commons from http://en.wikipedia.org/wiki/Internet_Explorer_6

Microsoft Visual Studio 2013

Git Logo by Jason Long is licensed under the Creative Commons Attribution 3.0 Unported License.

Fully integratedGit support

Team Foundation Server / Visual Studio Online

Project 2

Issues

Project

MgmtBuild

Git SCC Provider

Project 1

Issues

Project

MgmtBuild

Git

3rd Party XCode

Eclipse

Shell

3rd Party Eclipse

Shell

… TFVC

……

TFS SCC Provider

Team Explorer

TFVC Object Model

Local Repo

LibGit2 / LibGit2Sharp

Other Remote

Git Repo

Git-TF

Distributed Version Control

Licensed under Creative Commons from https://www.flickr.com/photos/chriswaits/6547281019

Why Git

Very simple file system internallyGreat interchange

Other SCMDeployment Protocol (Azure, Heroku etc)

X-Plat Support (except windows…)

Centralized Version Control

Time

Version 1 Version 2 Version 3 Version 4

File A

File C

File B

1 2

1 2

1 2 3

Decentralized Version Control

Time

Version 1 Version 2 Version 3 Version 4

File A

File C

File B

A A

B B

C C C

B

A

Git Basics.git folder is your repositoryEverything else is your working copyTracked vs Untracked Files

Git StagesCommittedStagedModified New files need to be ‘tracked’

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...

CommitsContain meta-data

commit 4d2460a...

Parent commit: 6d36faa...

Author: Display Name <[email protected]> Timestamp

Committer: Email Address <[email protected]> Timestamp

Installing Git

Download from website:

http://git-scm.com/download/win

Chocolatey

PS:\>iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))

C:\> cinst poshgitC:\> cinst git-credential-winstore

First Time UseGit config

config file in $Home directory

Setusername and emaildefault text editordefault diff tool

BranchIs just a file that points to a commitDefault branch is masterEach commit moves the pointer forward

Commit 1

Commit 3

Commit 2

Master

Create a branchgit branch TechEd

Commit 1

Commit 4

Commit 2

Commit 3

Master

TechEd

HEADgit checkout TechEdgit commit

HEAD TechEd

Demo

Stages and Branching

MergingGit chooses the ancestorCreates a merge commit

Merge conflictWill try to automergeConflicts are unstagedManual merge is defaultWill launch merge tool if configured

Demo

Merging

Remote BranchesReference to different repoLook like

(remote / branch)origin / master

Can have multiple remote branches

Cloning a repository

Commit 1

Commit 2

Commit 3

Master

http://Git.rob.com

Git clone http://git.rob.com

Commit 1

Commit 2

Commit 3

Origin/master

Master

History is localCommit local does not move origin/masterCan push whole branches also

Re-writing historyRebaseRebase -i

Visual Studio & Git

Demo

Visual Studio & Git

Advanced / CoolnessCherry PickingHooksTags

WorkflowsCentralizedPull RequestGitFlow

When its all said and doneGit is super fastGit is different, and it will take some timeVisual Studio support is good and its getting betterVisual Studio Online support is great

Related contentDEV-H212 Introduction to Team Development Using Visual Studio OnlineDEV-H210 Getting Started with Git Using Team Foundation Server 2013

Resources

TechNet & MSDN FlashSubscribe to our fortnightly newsletter

http://aka.ms/technetnz http://aka.ms/msdnnz

TechNet Virtual LabsFree Virtual Hands-on Labs

http://aka.ms/ch9nz

Microsoft Virtual AcademyFree Online Learning

http://aka.ms/mva http://aka.ms/technetlabs

Sessions on Demand

Complete your session evaluation now and win!

© 2014 Microsoft Corporation. All rights reserved.Microsoft, Windows and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.