SlideShare a Scribd company logo
1 of 56
Download to read offline
git   beyond
                               the
                               basics




Thursday, August 2, 12
John Bohn
                           @jjbohn



Thursday, August 2, 12
Developer at OpenSky
                            curated social commerce




Thursday, August 2, 12
what
                           is   git

Thursday, August 2, 12
git is fast and lightweight
                         free/open source
                         distributed
                         crazy simple

Thursday, August 2, 12
init
                         branch
                         add
                         commit
                         merge

Thursday, August 2, 12
Almost any VCS works does this
                              (more or less)



                         What is special about git?




Thursday, August 2, 12
Interactivity



Thursday, August 2, 12
git add --patch
                         git add --interactive


Thursday, August 2, 12
Arduino Example




Thursday, August 2, 12
Change Blink




Thursday, August 2, 12
Change Blink




                         - Two logical changes
                         - Don’t want to bother undoing one
                         - Can’t git add . or git add [file]
Thursday, August 2, 12
git add --patch




Thursday, August 2, 12
git add --patch




Thursday, August 2, 12
git add --patch




Thursday, August 2, 12
git add --patch
          Commit the change




Thursday, August 2, 12
git add --patch
          Stage other changes




   Diff is now empty (everything is staged or commited)
Thursday, August 2, 12
git stash


Thursday, August 2, 12
is super boring


Thursday, August 2, 12
until you throw
                         some flags at it...


Thursday, August 2, 12
My Favorites
    git stash --no-keep-index
    git stash --keep-index
    git stash --include-untracked
    git stash --patch


Thursday, August 2, 12
Finding these
  commands is just
  a matter of
  digging

Thursday, August 2, 12
git anything --help


Thursday, August 2, 12
git reset
                           is not
                         git revert

Thursday, August 2, 12
git reset --soft [sha]
       git reset --hard [sha]
       git reset --mixed [sha]

Thursday, August 2, 12
You can also:
       git reset --patch
       (but not with those modes)

Thursday, August 2, 12
Bisecting
                          aka: Finding a commit
                         that screwed things up.


Thursday, August 2, 12
Bisecting




Thursday, August 2, 12
Bisecting

        7b35b            2ab1f   9680d   91296   c6d43   cfc332



        6 Commits - One Bug
        We know that 7b35b is good
        We know that cfc332 is bad
        But we have no idea where the bug was introduced

Thursday, August 2, 12
Bisecting

        7b35b            2ab1f   9680d   91296   c6d43   cfc332
             good                                          bad




       Tell git what is known good and bad




Thursday, August 2, 12
Bisecting

        7b35b            2ab1f   9680d   91296   c6d43   cfc332
             good                                          bad




Thursday, August 2, 12
Bisecting

        7b35b            2ab1f   9680d   91296   c6d43   cfc332
             good                 good                     bad




Thursday, August 2, 12
Bisecting

        7b35b            2ab1f   9680d   91296   c6d43   cfc332
             good         good    good                     bad




Thursday, August 2, 12
Bisecting

        7b35b            2ab1f   9680d   91296   c6d43   cfc332
             good         good    good                     bad




     2ab1f is most likely good because the commit after it is




Thursday, August 2, 12
Bisecting

        7b35b            2ab1f   9680d   91296   c6d43   cfc332
             good         good    good            bad      bad




Thursday, August 2, 12
Bisecting

        7b35b            2ab1f   9680d   91296   c6d43   cfc332
             good         good    good    bad     bad      bad




Thursday, August 2, 12
Recovering lost commits



Thursday, August 2, 12
git reflog




Thursday, August 2, 12
git reflog



   Technically shows any action where the tip of a branch
   is modified

   git reflog --all
   shows stashes, bisects, etc.

Thursday, August 2, 12
Recovery



 Let’s say I reset --hard and wiped out the commit that
 changed my LED to pin 10
 Use combination of reflog and cherry-pick to get it back


Thursday, August 2, 12
Recovery




                         Found it! 3ecdba3
Thursday, August 2, 12
Recovery
 Double check that 3ecdba3 is really the commit we want




                         git diff 3ecdba3^.. 3ecdba3


 Shows me the difference between the commit I want
 to cherry pick and the commit prior.
Thursday, August 2, 12
git cherry-pick
                  Now cherry pick 3ecdba3 into our working tree




    Note: the sha has changed because this commit now has
    a different parent than it did when it was recorded into
    the reflog
Thursday, August 2, 12
Recovery
            Checkout the reflog again to see the cherry-pick




Thursday, August 2, 12
Interactive Rebasing
                               Changing the past
                               one commit at a
                               time




Thursday, August 2, 12
git rebase -i [commit]




Thursday, August 2, 12
git rebase -i [commit]




Thursday, August 2, 12
git rebase -i [commit]




Thursday, August 2, 12
git rebase -i [commit]




Thursday, August 2, 12
Interactive rebase




Thursday, August 2, 12
git internals
                         The plumbing and the porcelain




Thursday, August 2, 12
git internals
     git stores snapshots, not differences
     Storing differences is slow and inflexible

   CVS/Subversion                                git




Thursday, August 2, 12
git internals
     git stores snapshots, not differences
     Storing differences is slow and inflexible

   CVS/Subversion                                git




Thursday, August 2, 12
git internals
                         What does a commit look like?




Thursday, August 2, 12
git internals
                Let’s investigate a repo




                                  Sorry for the bad “investigation” image ;-)

Thursday, August 2, 12
Thanks!
                         Come work with me at OpenSky!
                               We’re Hiring




Thursday, August 2, 12

More Related Content

Recently uploaded

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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
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
 
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 Scriptwesley chun
 
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.pdfsudhanshuwaghmare1
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
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
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
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...Neo4j
 
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...Drew Madelung
 

Recently uploaded (20)

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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
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
 
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
 
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
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
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...
 
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...
 

Featured

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
 
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...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Featured (20)

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...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 

Git Beyond Basics - Interactive, Powerful Commands

  • 1. git beyond the basics Thursday, August 2, 12
  • 2. John Bohn @jjbohn Thursday, August 2, 12
  • 3. Developer at OpenSky curated social commerce Thursday, August 2, 12
  • 4. what is git Thursday, August 2, 12
  • 5. git is fast and lightweight free/open source distributed crazy simple Thursday, August 2, 12
  • 6. init branch add commit merge Thursday, August 2, 12
  • 7. Almost any VCS works does this (more or less) What is special about git? Thursday, August 2, 12
  • 9. git add --patch git add --interactive Thursday, August 2, 12
  • 12. Change Blink - Two logical changes - Don’t want to bother undoing one - Can’t git add . or git add [file] Thursday, August 2, 12
  • 16. git add --patch Commit the change Thursday, August 2, 12
  • 17. git add --patch Stage other changes Diff is now empty (everything is staged or commited) Thursday, August 2, 12
  • 20. until you throw some flags at it... Thursday, August 2, 12
  • 21. My Favorites git stash --no-keep-index git stash --keep-index git stash --include-untracked git stash --patch Thursday, August 2, 12
  • 22. Finding these commands is just a matter of digging Thursday, August 2, 12
  • 24. git reset is not git revert Thursday, August 2, 12
  • 25. git reset --soft [sha] git reset --hard [sha] git reset --mixed [sha] Thursday, August 2, 12
  • 26. You can also: git reset --patch (but not with those modes) Thursday, August 2, 12
  • 27. Bisecting aka: Finding a commit that screwed things up. Thursday, August 2, 12
  • 29. Bisecting 7b35b 2ab1f 9680d 91296 c6d43 cfc332 6 Commits - One Bug We know that 7b35b is good We know that cfc332 is bad But we have no idea where the bug was introduced Thursday, August 2, 12
  • 30. Bisecting 7b35b 2ab1f 9680d 91296 c6d43 cfc332 good bad Tell git what is known good and bad Thursday, August 2, 12
  • 31. Bisecting 7b35b 2ab1f 9680d 91296 c6d43 cfc332 good bad Thursday, August 2, 12
  • 32. Bisecting 7b35b 2ab1f 9680d 91296 c6d43 cfc332 good good bad Thursday, August 2, 12
  • 33. Bisecting 7b35b 2ab1f 9680d 91296 c6d43 cfc332 good good good bad Thursday, August 2, 12
  • 34. Bisecting 7b35b 2ab1f 9680d 91296 c6d43 cfc332 good good good bad 2ab1f is most likely good because the commit after it is Thursday, August 2, 12
  • 35. Bisecting 7b35b 2ab1f 9680d 91296 c6d43 cfc332 good good good bad bad Thursday, August 2, 12
  • 36. Bisecting 7b35b 2ab1f 9680d 91296 c6d43 cfc332 good good good bad bad bad Thursday, August 2, 12
  • 39. git reflog Technically shows any action where the tip of a branch is modified git reflog --all shows stashes, bisects, etc. Thursday, August 2, 12
  • 40. Recovery Let’s say I reset --hard and wiped out the commit that changed my LED to pin 10 Use combination of reflog and cherry-pick to get it back Thursday, August 2, 12
  • 41. Recovery Found it! 3ecdba3 Thursday, August 2, 12
  • 42. Recovery Double check that 3ecdba3 is really the commit we want git diff 3ecdba3^.. 3ecdba3 Shows me the difference between the commit I want to cherry pick and the commit prior. Thursday, August 2, 12
  • 43. git cherry-pick Now cherry pick 3ecdba3 into our working tree Note: the sha has changed because this commit now has a different parent than it did when it was recorded into the reflog Thursday, August 2, 12
  • 44. Recovery Checkout the reflog again to see the cherry-pick Thursday, August 2, 12
  • 45. Interactive Rebasing Changing the past one commit at a time Thursday, August 2, 12
  • 46. git rebase -i [commit] Thursday, August 2, 12
  • 47. git rebase -i [commit] Thursday, August 2, 12
  • 48. git rebase -i [commit] Thursday, August 2, 12
  • 49. git rebase -i [commit] Thursday, August 2, 12
  • 51. git internals The plumbing and the porcelain Thursday, August 2, 12
  • 52. git internals git stores snapshots, not differences Storing differences is slow and inflexible CVS/Subversion git Thursday, August 2, 12
  • 53. git internals git stores snapshots, not differences Storing differences is slow and inflexible CVS/Subversion git Thursday, August 2, 12
  • 54. git internals What does a commit look like? Thursday, August 2, 12
  • 55. git internals Let’s investigate a repo Sorry for the bad “investigation” image ;-) Thursday, August 2, 12
  • 56. Thanks! Come work with me at OpenSky! We’re Hiring Thursday, August 2, 12