Introduction to Git
Uri Goldstein
What is Git?
• A Version Control System like SVN - ONLY
BETTER.
• Everything is faster and easier:
– Committing.
– Reverting.
– Branching.
– Merging.
• Work disconnected = Offline.
What is GitHub?
• A web-based git hosting service.
• Like Assembla, only better. 
• Uses a simple workflow = GitHub Flow.
• Extremely popular.
• A community of devs sharing
code.
But…
• Git is a Swiss Army Knife.
• Once you master it,
it’ll make your life easier.
LIFECYCLE OF A CHANGE
Subversion
SVN Server
TCMW
Repository
Uri’s Machine
TCMW
Local Copy
Lior’s Machine
TCMW
Local Copy
Git – Everyone Gets a Repo
Git Server
TCMW
Repository
Uri’s Machine
TCMW
Working
Copy
Lior’s Machine
TCMW
Working
Copy
TCMW
Repository
TCMW
Repository
“Origin”
GitHubUri’s Machine
Lifecycle of a Change
Staging
Area
Local Git
Repository
Remote Git
Repository
Commit PushC:dev
MyClass.cs
Stage
Demo
Lifecycle of a Change – Cont’d
GitHubLior’s Machine
C:dev
MyClass.cs
Local Git
Repository
Remote Git
Repository
Merge Pull
BRANCHES
Subversion
• Creating branches takes time.
• Commits are big.
• SVN stores diffs in repo.

• Merging is a pain
Subversion
Trunk
Uri makes
changes
on his machine
Lior makes
changes
on his machine
Conflict
Git
• Creating branches is a snap.
• Commits are small and frequent.
• Git stores full files in repo.

• Merging is a joy much less painful.
Master
Lior’sFeature
Git
Uri’sFeature
Branch
Pull
Push
Branch
Pull
Push
Pull
Pull
Master
Branch
Push
Lior’sFeature
Git
Uri’sFeature
Uri’sBugFix
Branch
Pull
Push
Branch
Pull
Push
Pull
Pull
Demo
GITHUB AND GITHUB FLOW
GitHub
• Huge online community for open-source
projects = Public.
• Huge online service for commercial start-ups
and enterprises = PRIVATE.
• Runs Git Flow.
GitHub Flow
GitHub Flow
• ‘master’ branch is always stable.
• Devs use ‘feature’* branches.
• Feature branches pull from master freely.
• Feature branches merge back to master via
Pull Request = PR.
• Pull Request reviewed by peer + auto tests.
 ‘master’ branch is always stable.
A day in the life 1/2
• Brew a hot cup of coffee.
• Pull latest from origin master.
• Need to work on new feature 
• Branch = create new feature branch.
• Code and commit in small increments.
• Lunch! 
A day in the life 2/2
• Brew a hot cup of coffee.
• Pull latest from origin master.
• Resolve tiny conflicts easily.
• Verify quality with unit/integ. tests.
• Submit Pull Request (PR) for review.
• Nag reviewers to review.
• PR accepted? Verify master green on build server
• Celebrate the day with a drink. 
Demo
Thank you.
• http://tinyurl.com/gitandgithub
• Git Documentation
http://www.git-scm.com/
• Pro Git – Free book
http://www.git-scm.com/book/en/v2
• GitHub
http://github.com/
• SourceTree – Git Client
https://www.sourcetreeapp.com/
• Use Visual Studio with Git
https://msdn.microsoft.com/en-us/library/hh850437.aspx

Intro to Git and GitHub

Editor's Notes

  • #10 Setup? Clone Change on disk Add to staging Commit to local Push to remote
  • #18 Pull from remote Branch Feature Make changes Commit   Branch Bug Commit and push Checkout Feature Pull Push
  • #25 Pull from remote Branch Feature Make changes Commit   Branch Bug Commit and push Checkout Feature Pull Push