chicago alm user group git demo script and notes

14
InCycle Software Discovery Session Notes Git Demo Script & Notes Overview....................................................................................................1 Presentation................................................................................................2 Prerequisites...............................................................................................2 Setup.......................................................................................................3 Demo Script.................................................................................................3 Original Demo Script Notes.................................................................................10 Source Control...........................................................................................10 Eclipse..................................................................................................10 Training.................................................................................................10 Useful MSDN Links........................................................................................11 Git Resources............................................................................................11 Tools....................................................................................................11 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. Page 1 of 14

Upload: dave-burnison

Post on 03-Sep-2014

50 views

Category:

Software


1 download

DESCRIPTION

Presentation materials from the 6/25/2014 Chicago ALM User Group meeting - Git and Visual Studio Integration. Git, Visual Studio, Team Foundation Server

TRANSCRIPT

Page 1: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Notes

Git Demo Script & NotesOverview............................................................................................................................................................................................................................................... 1

Presentation.......................................................................................................................................................................................................................................... 2

Prerequisites.......................................................................................................................................................................................................................................... 2

Setup..................................................................................................................................................................................................................................................... 3

Demo Script........................................................................................................................................................................................................................................... 3

Original Demo Script Notes................................................................................................................................................................................................................. 10

Source Control................................................................................................................................................................................................................................. 10

Eclipse.............................................................................................................................................................................................................................................. 10

Training............................................................................................................................................................................................................................................ 10

Useful MSDN Links........................................................................................................................................................................................................................... 11

Git Resources................................................................................................................................................................................................................................... 11

Tools................................................................................................................................................................................................................................................ 11

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.

Page 1 of 12

Page 2: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Notes

Presentation See Visual Studio 2013 ALM - Git Source Control.pptx

Prerequisites A Team Project on VisualStudioOnline, (e.g. CALMUG – Git)

o Scrum Process Templateo Git Version Controlo Two members (e.g. Dave Burnison [email protected] and David Burnison, Jr. [email protected]) o A few PBIs and tasks so that you can associate a task to a commit or two.

Page 2 of 12

Page 3: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Noteso 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.

Page 3 of 12

Page 4: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Notes

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 ScriptInstructions Screen ShotGo 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 SyncGo to the web view and refresh. Now you see the changesOpen Default.aspx & About.aspx and make some edits.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

Page 4 of 12

Page 5: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Notesstaged. Exclude Default.aspx.Commit the change to About.aspx.Include Default.aspx but DO NOT Commit the change yetNote 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%\Source\Repos\[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 HistoryGo 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 repoo NOTE: If there are conflicts, you will be asked to resolve them.

Push – Push your changes to the severo 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.aspxGo 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.Close all documents and open the solution again.Go to Solution Explorer (ensure that PBI2DevBranch is selected) and open & change

Page 5 of 12

Page 6: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session NotesAbout.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.aspxEnsure 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 RequestGo 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)

Page 6 of 12

Page 7: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session NotesApprove 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

Page 7 of 12

Page 8: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session NotesDo 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

Page 8 of 12

Page 9: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Notes 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 branchOpen 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 alertsTo 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 AccessTo 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”.

Page 9 of 12

Page 10: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Notes

Page 10 of 12

Page 11: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Notes

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.

Eclipseo 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/

Page 11 of 12

Page 12: Chicago alm user group   git demo script and notes

InCycle Software Discovery Session Notes 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

Toolshttp://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-gitPosh-Git (for PowerShell users)

Page 12 of 12