SlideShare a Scribd company logo
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
GIT: An Illustrated Primer
http://mojolive.com/profile/dcousineau
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
History
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
BitKeeper No Longer Free To Use
Linux Kernel Requires
Distributed
Performant
SVN and CVS... Not So Much
“CVS is what we should NOT do...”
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
GIT
thus,
gItting
started
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Linux
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> sudo apt-get install git
$> sudo yum install git
$> echo "Seriously?"
+OSX
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
http://git-scm.com
+OSX
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
$> brew install git
$> say "Win!"
+Windows
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
http://windows.github.com
+Gitting STarted
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+My First Repo
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Stage New Files
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Commit Staging
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+staging?
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory
index
repository
+staging?
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory
index
repository
“staging”
+staging?
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory
index
repository
modify
+staging?
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory
index
repository
git add
+staging?
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
working directory
index
repository git commit
+Directories
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Modify
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Branch!
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Back to Master
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Merge!
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+stashing
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Popping
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
branching
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
a b c
MASTER
HEAD
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
a b c
MASTER
DEVELOP
create new branch
HEAD
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
a b c
MASTER
DEVELOP
Checkout new branch
HEAD
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
a b c
MASTER
DEVELOP
commit to develop
d
HEAD
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
commit to master HEAD
a b c
MASTER
DEVELOP
d
e
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
a b c
MASTER
DEVELOP
merge Develop
d
e
f
Remote
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
SVN GIT
d
e
b
a
c
d
e
b
a
c
d d
e
b
a
c
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Create a Project
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Create a Project
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Doing as I am told
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+did as I was told
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Push Again!
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Fetching & Merging
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Pulling
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Two Authors Two Pushes
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Two Authors Two Pushes
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+AFtermath
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Aftermath
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Aftermath
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+AFtermath
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+forking
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+pull requests
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+MAke Changes IN A NEW BRANCH
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Push Changes
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+See Our New Branch
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Create Pull Request
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Oh Look, Our Pull Request
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Oh Look Our Pull Request
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Oh Look, It’s Merged In!
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Remotes
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Adding Another Remote
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+create and sync new branches
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Delete local and remote branches
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Pull From One, Push To Another
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
GIT FLow
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
http://nvie.com/posts/a-successful-git-branching-model/
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Subversion
and GIT
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+et voilà
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git svn clone -s -r 1000:HEAD https://url/to/repo ./wkngcpy
$> git svn show-ignore > .gitignore
+Workflow
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
Normal GIT Workflow
+Sync
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git svn dcommit --dry-run
$> git svn dcommit
$> git svn rebase
+With some caveats
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
anything that has been dcommit’d
is set in stone! do. not. touch.
git branches well
svn... not so much
+Local Branching
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git merge --squash branch
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
git merge --squash localbrn
HEAD
a b
c
MASTER
localbrn
d e
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
git merge --squash localbrn
HEAD
a b
MASTER
DEC
+Why?
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
SVN is TERRIBLE at merges
git-svn will do it if you don’t
and when it fails, it does so spectacularly
you’ll just litter your commit history
+tracking svn branches
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git checkout -t remotes/branchname
+creating remote branches
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git svn branch -m “Creating new branch” branchname
$> git checkout -t remotes/branchname
+personal opinion
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
except for release tagging
and a develop branch
don’t bother with remote branching
just stick to local and squashes
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
use git svn
locally
push for
team
adoption
procure git
server
full clone
push to new
git server
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
use git svn
locally
push for
team
adoption
procure git
server
full clone
push to new
git server
Advanced
Usage
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+reset my local changes
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git checkout -- .
tell git “no more options!”
+Replay Last commit
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git reset --mixed REF
+Gitting Ready
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Results
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Undo Last commit
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git reset --hard HEAD^
HEAD^ means commit prior
to HEAD. HEAD^2 is 2
commits prior, etc etc.
+“Oops i forgot to branch”
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git branch newbranchname
$> git reset --hard SHA
commit immediately before
the intended first commit
of our new branch
+“Oops i forgot to branch”
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+“Oops i forgot to branch”
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+“Oops I accidentally the commit message”
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git rebase --interactive SHA
commit immediately
preceding the commit in
question
+Oops
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Lay of the land
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Making decisions
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Reach 88MPH
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Fun with Paradoxes
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Fruits of our labor
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+“Oops I committed the private key”
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
$> git filter-branch --index-filter 
'git rm --cached --ignore-unmatch secret.key' 
--prune-empty --tag-name-filter cat -- --all
ಠ_ಠ
+Terrible Mistake
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+gone now, here yesterday
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+VooDoo Magic
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Results
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Cleanup The Mess
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+Look Ma, No secret.key!
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
THANKS.FOR YOUR ATTENTION
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
+further resources
Daniel Cousineau // follow me : @dcousineau or http://dcousineau.com
http://git-scm.com/book
FREE!
Attribution-NonCommercial-ShareAlike 3.0 Unported
https://help.github.com

More Related Content

PDF
Git workflow in agile development
PPTX
Automated Deployment With Phing
PDF
JavaScript Primer
KEY
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
PDF
JavaScript Primer
PDF
jQuery Mobile: For Fun and Profit
PDF
Disregard Inputs, Acquire Zend_Form
PDF
2024 Trend Updates: What Really Works In SEO & Content Marketing
Git workflow in agile development
Automated Deployment With Phing
JavaScript Primer
NOSQL101, Or: How I Learned To Stop Worrying And Love The Mongo!
JavaScript Primer
jQuery Mobile: For Fun and Profit
Disregard Inputs, Acquire Zend_Form
2024 Trend Updates: What Really Works In SEO & Content Marketing

Recently uploaded (20)

PDF
Encapsulation theory and applications.pdf
PDF
A comparative study of natural language inference in Swahili using monolingua...
PPTX
A Presentation on Artificial Intelligence
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Univ-Connecticut-ChatGPT-Presentaion.pdf
PPTX
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
PDF
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Approach and Philosophy of On baking technology
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Hybrid model detection and classification of lung cancer
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
August Patch Tuesday
PDF
Web App vs Mobile App What Should You Build First.pdf
Encapsulation theory and applications.pdf
A comparative study of natural language inference in Swahili using monolingua...
A Presentation on Artificial Intelligence
gpt5_lecture_notes_comprehensive_20250812015547.pdf
ENT215_Completing-a-large-scale-migration-and-modernization-with-AWS.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Univ-Connecticut-ChatGPT-Presentaion.pdf
TechTalks-8-2019-Service-Management-ITIL-Refresh-ITIL-4-Framework-Supports-Ou...
Transform Your ITIL® 4 & ITSM Strategy with AI in 2025.pdf
Chapter 5: Probability Theory and Statistics
Approach and Philosophy of On baking technology
OMC Textile Division Presentation 2021.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
A novel scalable deep ensemble learning framework for big data classification...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
Group 1 Presentation -Planning and Decision Making .pptx
Hybrid model detection and classification of lung cancer
Encapsulation_ Review paper, used for researhc scholars
August Patch Tuesday
Web App vs Mobile App What Should You Build First.pdf
Ad
Ad

Git, an Illustrated Primer