Presentation materials from the 6/25/2014 Chicago ALM User Group meeting - Git and Visual Studio Integration.
Git, Visual Studio, Team Foundation Server
A Secure and Reliable Document Management System is Essential.docx
Chicago alm user group git demo script and notes
1. InCycle Software Discovery Session Notes
Page 1 of 12
Git Demo Script & Notes
Overview.................................................................................................................................................................................................................................................. 1
Presentation............................................................................................................................................................................................................................................. 2
Prerequisites ............................................................................................................................................................................................................................................ 2
Setup........................................................................................................................................................................................................................................................ 4
Demo Script.............................................................................................................................................................................................................................................. 4
Original Demo Script Notes.................................................................................................................................................................................................................... 11
Source Control ................................................................................................................................................................................................................................... 11
Eclipse ................................................................................................................................................................................................................................................ 11
Training .............................................................................................................................................................................................................................................. 11
Useful MSDN Links............................................................................................................................................................................................................................. 12
Git Resources ..................................................................................................................................................................................................................................... 12
Tools................................................................................................................................................................................................................................................... 12
Overview
The primary purpose was to show the Git implementation inside of Visual Studio and compare and contrast Git based Team Projects with Team
Foundation Version Control (TFVC) based Team Projects.
It is assumed that the audience is familiar with TFVC and this is presented a way to compare and contrast TFVC and Git.
This document started as a rough script created by Dave Burnison for a Discovery session about Git and then morphed into a presentation that was given
to the Chicago ALM User Group.
Key Point: Everything that we are going to demonstrate is part of one product family. MSysGit, is the only component that do not ship with Team
Foundation Server / Visual Studio.
2. InCycle Software Discovery Session Notes
Page 2 of 12
Presentation
See Visual Studio 2013 ALM - Git Source Control.pptx
Prerequisites
A Team Project on VisualStudioOnline, (e.g. CALMUG – Git)
o Scrum Process Template
o Git Version Control
o Two members (e.g. Dave Burnison daveburnison@yahoo.com and David Burnison, Jr. daveburnison@icloud.com)
o A few PBIs and tasks so that you can associate a task to a commit or two.
3. InCycle Software Discovery Session Notes
Page 3 of 12
o Contains one web application created in Visual Studio using File > New Project… with the following settings:
o When making source code changes, use Default.aspx and/or About.aspx as these files contain multiple text strings that can easily be changed to
generate the needed diffs between commits.
4. InCycle Software Discovery Session Notes
Page 4 of 12
Setup
If you run through this for practice be sure to delete the PBI2DevBranch and revert Default.aspx and About.aspx to their original states.
Open Visual Studio 2013 ALM - Git Source Control.pptx
Open the Browser to https://daveburnison.visualstudio.com/DefaultCollection/CALMUG%20-%20Git
Demo Script
Instructions Screen Shot
Go to https://daveburnison.visualstudio.com/DefaultCollection/CALMUG%20-%20Git and
select “Open in Visual Studio”
Go to the “Connect” page, right click on the “CALMUG – Git” repo and select “clone”
Go to the Changes page.
Click on Actions > View History. Do the same from the web client to show that the remote
repository is in sync with my local repository.
Open Commit 4e59d3eb, “Really important code change in the Master Branch.”
Commit to see a related work item.
Click on Actions > Open in File Explorer. Copy/Paste the path then open the solution from
that path in Visual Studio.
Open About.aspx and make some edits.
Commit the changes.
Open Default.aspx and make some edits.
Commit the changes.
Go to the web view to show that the changes are not yet on the server.
Go to Unsynced Commits and show that the commits are “Staged”
Press Sync
Go to the web view and refresh. Now you see the changes
Open Default.aspx & About.aspx and make some edits.
5. InCycle Software Discovery Session Notes
Page 5 of 12
From Changes, note how you can Exclude files if there are files that you have touched, but
you don’t want them to be part of the next Commit. This is how you manage the files that are
staged. Exclude Default.aspx.
Commit the change to About.aspx.
Include Default.aspx but DO NOT Commit the change yet
Note how you do other things from the Actions menu
Open file Explorer
Open a command prompt. Note that we are put in the appropriate context: e.g.
“C:%username%SourceRepos[Project Name]”
o Run “git status” to show the changes that are currently staged.
o Run “git remote –v” to show the connection to the TFS server.
o Run “git tag NewTag”
o Run “git help” to show the available commands.
o Run “git help fetch” to show how the detailed documentation will appear.
View History
Go to Unsynced Commits and discuss the options as found on the Collaborate page. (Make a
Power point Page for this).
Fetch - Preview the changes from your team before you integrate them into your
work. After you fetch a commit, to get more information, open its context menu and
choose View Commit Details.
Pull – Get changes from the remote repo
o NOTE: If there are conflicts, you will be asked to resolve them.
Push – Push your changes to the sever
o If your team has pushed commits to the branch since you last cloned or
pushed, then you must first pull all the changes from the remote repository
before you can push your changes into it.
Sync –Pull changes from the remote repo into the local repo and push your changes
to the sever in a single step.
Go to Changes. Note how you can drop down the “Commit” button and select the following
options
Commit
Commit and Push
Commit and Sync
Commit and Sync the changes to Default.aspx
Go to Branches and create PBI2DevBranch. Note how the branch is only in the local
repository unless you Publish it to the remote repository.
Publish the new branch to make it visible on the server.
6. InCycle Software Discovery Session Notes
Page 6 of 12
Close all documents and open the solution again.
Go to Solution Explorer (ensure that PBI2DevBranch is selected) and open & change
About.aspx.
Open About.aspx and make some edits.
Associate the “PBI #2, Task #3” task
Commit the changes.
Open Default.aspx and make some edits.
Associate the “PBI #2, Task #3” task.
Open the task and set the status to In Progress
Commit the changes.
Go to Changes
Note how the file list is automatically updated.
Move Default.aspx to excluded changes.
Change the context back and forth between PBI2DevBranch and Master and note
how About.aspx changes.
Commit and Sync the changes to About.aspx & Default.aspx
Ensure that the context is PBI2DevBranch and View History.
NOTE: You can now see how Master and PBI2DevBranch have diverged.
Go to Branches and show how you could do a merge, but don’t do it now as it will be done as
part of a Pull Request
Go to the Web View and start a Pull Request
New Pull Request
Review changes in “PBI2DevBranch” relative to “Master”
Enter ‘Changes related to “PBI #2, Task #2” ‘ as the subject.
Enter ‘Please review my changes to blah blah blah’
Enter ‘David Burnison Jr.’ as the reviewer
NOTE: As of 6/25/2014, Pull Requests are very new to VSO
and not yet available for on premises TFS. Refer to Conduct a
Git pull request on Visual Studio Online
Log out of Team Web Access and login as David Burnison Jr.
Go to Pull Requests > Assigned to Me and enter comments on the changed files.
Go to the Code page and enter
line level comments
file level comments
overall comments (Click on the Discussion page to show the comments you just
entered and enter overall comments)
7. InCycle Software Discovery Session Notes
Page 7 of 12
Approve the changes. Click on the Thumbs up button. (Click on the Thumbs Down button just
to show the Rejected state.
Click on Complete merge.
Point out the new Commit link in the upper right hand corner.
Go to Commits page and show how the changes from the PBI2DevBranch have been merged
to Master.
Log out of Team Web Access and login as Dave Burnison
8. InCycle Software Discovery Session Notes
Page 8 of 12
Do a Fetch to show the commits that need to be applied to the Master Branch.
Right click and select View Commit Details. Then right click on one of the files and select
Compare with Previous to see the file diffs.
Go to Unsynced Changes and Pull the changes to apply the merge to the local repository’s
Master branch.
Now find PBI #2, Task #3 and change the status to Done.
Go to Builds and go over Master Branch Manual Build
Uses a Git template
Specify which projects to build
View results for Manual Master Branch Build_20140624.2 and note how associated
tasks are in the build log.
Generate a Merge conflict
Close the solution
Set the context to the master branch
Open the solution
Make a change to About.aspx
9. InCycle Software Discovery Session Notes
Page 9 of 12
Commit the change
Generate a Merge conflict
Close the solution
Set the context to the PBI2DevBranch branch
Open the solution
Make a change to About.aspx
Commit the change
Go to Branches and merge from PBI2DevBranch to master branch
Open the conflict window and show how it is very similar to, if not the same as the TFVC
conflict resolution window.
Commit the merge.
Amend a commit:
Make a change to About.apsx
Commit it
Go to the Unsynced Changes page, select the most recent commit
Right click and select View Commit Details
Select About.aspx, right click and select Compare with previous
Make another change to About.apsx
Commit it
From the Changes window select Amend Previous Commit from the Actions menu
Go to the Unsynced Changes page, select the most recent commit
Right click and select View Commit Details
Select About.aspx, right click and select Compare with previous
Go To Web Access and Show how you can have Multiple Repos per Team Project.
Clone the “Second Demo Repo”
Copy the URL from Team Web Access
Paste the URL into the Clone window in Visual Studio
Show how you can set E-mail alerts.
Show how you can use Team Room alerts
To get an existing branch go to Branches and select New Branch, but select the desired
branch from Origin.
Set security for a branch from within Team Web Access
To delete a branch, you must get the branch and then “Unpublish” it, and then delete it from
your local repository.
Start “Git GUI” and select “Open”. Open the local repository related to the “CALMUG - Git”
project and then select “Repository > Visualize all branch History”.
11. InCycle Software Discovery Session Notes
Page 11 of 12
Original Demo Script Notes
Source Control
Full support for Git
o Changes vs. Pending Changes
Associating Tasks, Bugs, etc. with Commits / Changesets
NOTE: This only applies to the one repository name that matches the name of the team project. Otherwise, you have to include
the Work Item ID in the format of #999 in the comments.
Eclipse
o Team Explorer Everywhere
Work Items
Builds
Settings
Jump to browser for Admin pages.
o Git (Git Repository Explorer)
Just like using other Git repositories.
Clone
Get the TFS Git repository URL from the web Portal
Go to Git Repository Explorer and select “Clone”
NOTE: If this is the 1st
repository, you can click on the link.
Commit
Right click on the repository and select “Commit”
o Check the files that you want to include.
Push
Right click on the repository and select “Push to Upstream”
Training
Tool to learn all about how Git works (from Daniel)
o http://pcottle.github.io/learnGitBranching/
12. InCycle Software Discovery Session Notes
Page 12 of 12
Pluralsight
o Git Fundamentals
o Git for Visual Studio Developers
Useful MSDN Links
TFS/Git Home on MSDN
Details on the differences between TFVC and Git
Git repository permissions
Work from the Git command prompt
Visual Studio 2012 Tools for Git
TFS Internals: How does TFS store Git files
Git Resources
Git’s home on the internet
Online book “Pro Git”
Online reference for all git commands (don’t forget about “git help”!)
Try git in your browser, with step-by-step instructions
Tons of tips and tricks for Git users of all experience levels
Tools
http://msysgit.github.io/
Git command line for Windows (includes git-bash)
NOTE: This is what gets installed when you follow the prompts in Visual Studio.
http://code.google.com/p/tortoisegit
TortoiseGit (with TortoiseMerge)
http://github.com/dahlbyk/posh-git
Posh-Git (for PowerShell users)