SlideShare una empresa de Scribd logo
1 de 42
Descargar para leer sin conexión
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

Más contenido relacionado

Último

+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@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

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
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
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...
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
+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...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 

Destacado

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)
 

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