SlideShare une entreprise Scribd logo
1  sur  105
Télécharger pour lire hors ligne
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

Contenu connexe

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

En vedette

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

En vedette (20)

Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 

Git, an Illustrated Primer