SlideShare a Scribd company logo
1 of 42
Download to read offline
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

More Related Content

Recently uploaded

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 

Recently uploaded (20)

[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
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
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
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
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
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
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 

Featured

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
 

Featured (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