SlideShare une entreprise Scribd logo
1  sur  42
Télécharger pour lire hors ligne
GIT WITHTHE PROGRAM
Drupal Camp LA 2013
Matthew Wrather
Wrather Creative
ABOUT ME
• Freelance Drupal Developer
and Web Generalist since 1997
• Drupal since 4.6
• Most Definitely Available for Work!
matt@wrathercreative.com
(510) WRA-THER
SOURCES
• A great talk by @merlyn himself, Randal Schwartz CC-BY-SA
• OnVimeo at https://vimeo.com/35778382
• Slides at http://slidesha.re/z7nQrG
• Pro Git by Scott Chacon CC-BY-NC-SA
• Read for free at http://git-scm.com/book
• And many more at http://lmgtfy.com/?q=git+tutorial
AGENDA
1. Why UseVersion Control
2. Git basic concepts
3. Demo
Time for questions after each section.
DOESN’T USEVERSION CONTROL
slworking on Flickr
CC-BY-NC-SA
QUESTIONS?
WHAT IS GIT FOR?
Git is for…
• Tracks a tree of related files
• Distributed
• High Performance
• Easy & Fast Branch/Merge
• Good Data Integrity
• Collaborative
Git is not for…
• Tracking unrelated files
• Tracking File Metadata
• Binary Files
WRAPYOUR MIND AROUND
• Distributed:Your repository is complete unto itself.
• Anyone can commit!*
*To their own repo.
• (Once you start fetching and pushing work,
permissions come into play.)
• There can still be a central, blessed repo.
• Universal Public Identifiers: SHA1 hashes
OBJECTS IN GIT
• Blobs (actual data)
• Trees (directories of blobs or of other trees)
• A commit, which is:
• A tree
• Zero or more parent commits
• Metadata (commit message, name email, timestamp)
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
WE NEEDTOTALK
ABOUT COMMITMENT
Do this
Work
Stage
Commit
here
Filesystem
Staging Area
Repository
(aka here)
WorkingTree
Index
HEAD
by
writing code
git add
git commit
Rinse and Repeat
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ git commit
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ git branch testing
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ git checkout testing
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ subl awesome.module
$ git add awesome.module
$ git commit -m ‘changed awesome module’
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
$ git checkout master
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
BRANCHES
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
MERGING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
MERGING
$ git checkout -b iss53 # shortcut for:
$ # git branch iss53
$ # git checkout iss53
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
MERGING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
MERGING
FAST FORWARD MERGE
$ git checkout master
$ git merge hotfix
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
FAST FORWARD MERGE
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
FAST FORWARD MERGE
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
FAST FORWARD MERGE
$ git branch -d hotfix
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
RECURSIVE MERGE
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
RECURSIVE MERGE
$ git checkout master
$ git merge iss53
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
REBASING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
REBASING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
REBASING
graphic from Pro Git by Scott Chacon
CC-BY-NC-SA
REBASING
$ git checkout experiment
$ git rebase master
Thou shalt not rebase commits that you
have pushed to a remote repository.
REMOTE REPOSITORIES
• All these things that we’ve done so far happen in the privacy
of our own computer and don’t affect anything else.
• You can track what’s going on in other repositories by adding
them as “remotes”
git remote add <nickname> <remote-url>
• When you copy a repo using the git clone command,
you’ll automatically have a remote called origin
REMOTE REPOSITORIES
• When you’ve done working, you can “push” your work up to a
remote repository
git push <remote-nickname> <branch>
git push origin master
• But if someone else has done work and pushed it to the
remote repo, git won’t let you overwrite.
REMOTE REPOSITORIES
• To find out what’s on the server, you can “fetch” from a
remote repository
git fetch <remote-nickname>
git fetch origin
• Remote branches will be tracked locally, prefixed with the
remote nickname.The master branch on origin becomes
origin/master locally.
REMOTE REPOSITORIES
$ git push origin master
[git error message]
$ git fetch origin
$ git merge origin/master
$ git push master
[HUGE SUCCESS!]
QUESTIONS?
DEMO
THANKYOU!
Matthew Wrather • @mwrather
matt@wrathercreative.com • (510) WRA-THER

Contenu connexe

Dernier

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
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 AutomationSafe Software
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
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 2024The Digital Insurer
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Dernier (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
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
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
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 ChatGPTExpeed Software
 
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 EngineeringsPixeldarts
 
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 HealthThinkNow
 
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.pdfmarketingartwork
 
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 2024Neil Kimberley
 
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)contently
 
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 2024Albert Qian
 
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 InsightsKurio // The Social Media Age(ncy)
 
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 2024Search Engine Journal
 
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 summarySpeakerHub
 
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 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 Tessa Mero
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
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 managementMindGenius
 
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...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
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...
 

Git With The Program: Introduction to Basic Git Concepts - Drupal Camp LA 2013

  • 1. GIT WITHTHE PROGRAM Drupal Camp LA 2013 Matthew Wrather Wrather Creative
  • 2. ABOUT ME • Freelance Drupal Developer and Web Generalist since 1997 • Drupal since 4.6 • Most Definitely Available for Work! matt@wrathercreative.com (510) WRA-THER
  • 3. SOURCES • A great talk by @merlyn himself, Randal Schwartz CC-BY-SA • OnVimeo at https://vimeo.com/35778382 • Slides at http://slidesha.re/z7nQrG • Pro Git by Scott Chacon CC-BY-NC-SA • Read for free at http://git-scm.com/book • And many more at http://lmgtfy.com/?q=git+tutorial
  • 4. AGENDA 1. Why UseVersion Control 2. Git basic concepts 3. Demo Time for questions after each section.
  • 7. WHAT IS GIT FOR? Git is for… • Tracks a tree of related files • Distributed • High Performance • Easy & Fast Branch/Merge • Good Data Integrity • Collaborative Git is not for… • Tracking unrelated files • Tracking File Metadata • Binary Files
  • 8. WRAPYOUR MIND AROUND • Distributed:Your repository is complete unto itself. • Anyone can commit!* *To their own repo. • (Once you start fetching and pushing work, permissions come into play.) • There can still be a central, blessed repo. • Universal Public Identifiers: SHA1 hashes
  • 9.
  • 10. OBJECTS IN GIT • Blobs (actual data) • Trees (directories of blobs or of other trees) • A commit, which is: • A tree • Zero or more parent commits • Metadata (commit message, name email, timestamp)
  • 11. graphic from Pro Git by Scott Chacon CC-BY-NC-SA
  • 12. WE NEEDTOTALK ABOUT COMMITMENT Do this Work Stage Commit here Filesystem Staging Area Repository (aka here) WorkingTree Index HEAD by writing code git add git commit Rinse and Repeat
  • 13. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES
  • 14. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ git commit
  • 15. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ git branch testing
  • 16. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES
  • 17. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ git checkout testing
  • 18. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ subl awesome.module $ git add awesome.module $ git commit -m ‘changed awesome module’
  • 19. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES $ git checkout master
  • 20. graphic from Pro Git by Scott Chacon CC-BY-NC-SA BRANCHES
  • 21. graphic from Pro Git by Scott Chacon CC-BY-NC-SA MERGING
  • 22. graphic from Pro Git by Scott Chacon CC-BY-NC-SA MERGING $ git checkout -b iss53 # shortcut for: $ # git branch iss53 $ # git checkout iss53
  • 23. graphic from Pro Git by Scott Chacon CC-BY-NC-SA MERGING
  • 24. graphic from Pro Git by Scott Chacon CC-BY-NC-SA MERGING
  • 25. FAST FORWARD MERGE $ git checkout master $ git merge hotfix
  • 26. graphic from Pro Git by Scott Chacon CC-BY-NC-SA FAST FORWARD MERGE
  • 27. graphic from Pro Git by Scott Chacon CC-BY-NC-SA FAST FORWARD MERGE
  • 28. graphic from Pro Git by Scott Chacon CC-BY-NC-SA FAST FORWARD MERGE $ git branch -d hotfix
  • 29. graphic from Pro Git by Scott Chacon CC-BY-NC-SA RECURSIVE MERGE
  • 30. graphic from Pro Git by Scott Chacon CC-BY-NC-SA RECURSIVE MERGE $ git checkout master $ git merge iss53
  • 31. graphic from Pro Git by Scott Chacon CC-BY-NC-SA REBASING
  • 32. graphic from Pro Git by Scott Chacon CC-BY-NC-SA REBASING
  • 33. graphic from Pro Git by Scott Chacon CC-BY-NC-SA REBASING
  • 34. graphic from Pro Git by Scott Chacon CC-BY-NC-SA REBASING $ git checkout experiment $ git rebase master
  • 35. Thou shalt not rebase commits that you have pushed to a remote repository.
  • 36. REMOTE REPOSITORIES • All these things that we’ve done so far happen in the privacy of our own computer and don’t affect anything else. • You can track what’s going on in other repositories by adding them as “remotes” git remote add <nickname> <remote-url> • When you copy a repo using the git clone command, you’ll automatically have a remote called origin
  • 37. REMOTE REPOSITORIES • When you’ve done working, you can “push” your work up to a remote repository git push <remote-nickname> <branch> git push origin master • But if someone else has done work and pushed it to the remote repo, git won’t let you overwrite.
  • 38. REMOTE REPOSITORIES • To find out what’s on the server, you can “fetch” from a remote repository git fetch <remote-nickname> git fetch origin • Remote branches will be tracked locally, prefixed with the remote nickname.The master branch on origin becomes origin/master locally.
  • 39. REMOTE REPOSITORIES $ git push origin master [git error message] $ git fetch origin $ git merge origin/master $ git push master [HUGE SUCCESS!]
  • 41. DEMO
  • 42. THANKYOU! Matthew Wrather • @mwrather matt@wrathercreative.com • (510) WRA-THER