SlideShare uma empresa Scribd logo
1 de 21
a handful of Git
workflows for the
      agilist

        steven harman
    twitter: stevenharman
   http://stevenharman.net
stop worrying
   and start
loving The Git.
picture Git


image via: http://nvie.com/git-model
basic branch/feature
      workflow
remote Git repository (origin)




                   master
remote Git repository (origin)




                                    master




                local Git repository (your clone)


:> git clone git@github.com:stevenharman/foo.git
:> cd foo
:master>

                                   master    origin/master
remote Git repository (origin)




                                    master




                local Git repository (your clone)



:master> git checkout -b feature
:feature> [... hackity-hack-hack ...]
:feature> git commit -am ‘did something awesome.’

                  feature
                                   master    origin/master
remote Git repository (origin)



// someone else pushed a change to the remote.
                                    master

                                    master




                local Git repository (your clone)




                  feature
                                   master    origin/master
remote Git repository (origin)




                                    master

                                    master




                local Git repository (your clone)




:feature> [... more hackity-hack-hack ...]
:feature> git commit -am ‘more awesomeness. bacon!’

                  feature

                  feature
                                   master    origin/master
remote Git repository (origin)




                                    master

                                    master




                local Git repository (your clone)




:feature> git fetch origin

                  feature
                                    origin/master
                  feature
                                   master    origin/master
remote Git repository (origin)




                                    master

                                    master




                local Git repository (your clone)




:feature> git checkout master
:master> git merge origin/master

                  feature
                                   master     origin/master
                                    origin/master
                  feature
                                   master     origin/master
remote Git repository (origin)




                                    master

                                    master




                local Git repository (your clone)




:master> git merge feature
                                   master

                  feature
                                    origin/master
                                   master     origin/master
                                    origin/master
                  feature
                                   master     origin/master
remote Git repository (origin)




                    master

                    master




local Git repository (your clone)




  feature
                   master     origin/master
                    origin/master
  feature
                   master     origin/master
remote Git repository (origin)




                                    master

                                    master




                local Git repository (your clone)


:master> git checkout feature
:feature> git rebase master
                  feature
                                   master

                  feature
                                    origin/master
                                   master     origin/master
                                    origin/master
                  feature
                                   master     origin/master
remote Git repository (origin)




                                    master

                                    master




                local Git repository (your clone)


:feature> git checkout master
:master> git merge feature
                       feature
                  feature          master
                                   master

                  feature
                                    origin/master
                                    origin/master
                                   master     origin/master
                  feature
                                   master     origin/master
remote Git repository (origin)



                                    master




                                    master




                local Git repository (your clone)



:master> git push origin master

                       feature
                  feature          master     origin/master
                                   master

                  feature
                                    origin/master
                                    origin/master
                                   master     origin/master
                  feature
                                   master     origin/master
remote Git repository (origin)



                                    master




                                    master




                local Git repository (your clone)



:master> git branch -d feature

                       feature
                  feature          master     origin/master
                                   master

                  feature
                                    origin/master
                                    origin/master
                                   master     origin/master
                  feature
                                   master     origin/master
derivations

• branch for a spike
• branches for concurrent design
• push/pull changes directly from teammate
• stashing changes temporarily
• reset to prior commit (in case of FUBAR)
some cool tools for
    your Git utility belt
•   git reset
•   git cherry-pick
•   git stash
•   git bisect
•   git add -p
•   git reflog
•   git svn
get Git info

• http://ProGit.org (the site for THE book)
• http://gitready.com
• http://gitcasts.com
• http://whygitisbetterthanx.com/
• http://delicious.com/stevenharman/git
fork these slides from
http://github.com/stevenharman/git-workflows




                 steven harman
             twitter: stevenharman
            http://stevenharman.net

Mais conteúdo relacionado

Semelhante a Git workflow

Why You Should Be Using Git
Why You Should Be Using GitWhy You Should Be Using Git
Why You Should Be Using GitFrancisco Vieira
 
Git Anti Patterns - XP Days Ukraine 2017
Git Anti Patterns - XP Days Ukraine 2017Git Anti Patterns - XP Days Ukraine 2017
Git Anti Patterns - XP Days Ukraine 2017Lemi Orhan Ergin
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017Lemi Orhan Ergin
 
Git: A Getting Started Presentation
Git: A Getting Started PresentationGit: A Getting Started Presentation
Git: A Getting Started PresentationNap Ramirez
 
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...Lemi Orhan Ergin
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainLemi Orhan Ergin
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From GitChris Miller
 
#5 - Git - Contribuindo com um repositório remoto
#5 - Git - Contribuindo com um repositório remoto#5 - Git - Contribuindo com um repositório remoto
#5 - Git - Contribuindo com um repositório remotoRodrigo Branas
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using GitSusan Potter
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for GitJan Krag
 

Semelhante a Git workflow (20)

Presentacion git
Presentacion gitPresentacion git
Presentacion git
 
Why You Should Be Using Git
Why You Should Be Using GitWhy You Should Be Using Git
Why You Should Be Using Git
 
Git
GitGit
Git
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Git Anti Patterns - XP Days Ukraine 2017
Git Anti Patterns - XP Days Ukraine 2017Git Anti Patterns - XP Days Ukraine 2017
Git Anti Patterns - XP Days Ukraine 2017
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
Git Anti-Patterns: How To Mess Up With Git and Love it Again - DevoxxPL 2017
 
Git: A Getting Started Presentation
Git: A Getting Started PresentationGit: A Getting Started Presentation
Git: A Getting Started Presentation
 
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
Git Anti-Patterns - Extended Version With 28 Common Anti-Patterns) - SCTurkey...
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it Again
 
Git in 5 Minutes
Git in 5 MinutesGit in 5 Minutes
Git in 5 Minutes
 
Gitting the Most From Git
Gitting the Most From GitGitting the Most From Git
Gitting the Most From Git
 
T3dd10 git
T3dd10 gitT3dd10 git
T3dd10 git
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
#5 - Git - Contribuindo com um repositório remoto
#5 - Git - Contribuindo com um repositório remoto#5 - Git - Contribuindo com um repositório remoto
#5 - Git - Contribuindo com um repositório remoto
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Git
GitGit
Git
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Distributed Developer Workflows using Git
Distributed Developer Workflows using GitDistributed Developer Workflows using Git
Distributed Developer Workflows using Git
 
Jedi Mind Tricks for Git
Jedi Mind Tricks for GitJedi Mind Tricks for Git
Jedi Mind Tricks for Git
 

Último

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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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
 
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
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
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...DianaGray10
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
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 Takeoffsammart93
 
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
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
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 SavingEdi Saputra
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
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
 
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
 
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
 
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 TerraformAndrey Devyatkin
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 

Último (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
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
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...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
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...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
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
 
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...
 
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
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
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
 
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
 
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?
 
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
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 

Git workflow

  • 1. a handful of Git workflows for the agilist steven harman twitter: stevenharman http://stevenharman.net
  • 2. stop worrying and start loving The Git.
  • 3. picture Git image via: http://nvie.com/git-model
  • 5. remote Git repository (origin) master
  • 6. remote Git repository (origin) master local Git repository (your clone) :> git clone git@github.com:stevenharman/foo.git :> cd foo :master> master origin/master
  • 7. remote Git repository (origin) master local Git repository (your clone) :master> git checkout -b feature :feature> [... hackity-hack-hack ...] :feature> git commit -am ‘did something awesome.’ feature master origin/master
  • 8. remote Git repository (origin) // someone else pushed a change to the remote. master master local Git repository (your clone) feature master origin/master
  • 9. remote Git repository (origin) master master local Git repository (your clone) :feature> [... more hackity-hack-hack ...] :feature> git commit -am ‘more awesomeness. bacon!’ feature feature master origin/master
  • 10. remote Git repository (origin) master master local Git repository (your clone) :feature> git fetch origin feature origin/master feature master origin/master
  • 11. remote Git repository (origin) master master local Git repository (your clone) :feature> git checkout master :master> git merge origin/master feature master origin/master origin/master feature master origin/master
  • 12. remote Git repository (origin) master master local Git repository (your clone) :master> git merge feature master feature origin/master master origin/master origin/master feature master origin/master
  • 13. remote Git repository (origin) master master local Git repository (your clone) feature master origin/master origin/master feature master origin/master
  • 14. remote Git repository (origin) master master local Git repository (your clone) :master> git checkout feature :feature> git rebase master feature master feature origin/master master origin/master origin/master feature master origin/master
  • 15. remote Git repository (origin) master master local Git repository (your clone) :feature> git checkout master :master> git merge feature feature feature master master feature origin/master origin/master master origin/master feature master origin/master
  • 16. remote Git repository (origin) master master local Git repository (your clone) :master> git push origin master feature feature master origin/master master feature origin/master origin/master master origin/master feature master origin/master
  • 17. remote Git repository (origin) master master local Git repository (your clone) :master> git branch -d feature feature feature master origin/master master feature origin/master origin/master master origin/master feature master origin/master
  • 18. derivations • branch for a spike • branches for concurrent design • push/pull changes directly from teammate • stashing changes temporarily • reset to prior commit (in case of FUBAR)
  • 19. some cool tools for your Git utility belt • git reset • git cherry-pick • git stash • git bisect • git add -p • git reflog • git svn
  • 20. get Git info • http://ProGit.org (the site for THE book) • http://gitready.com • http://gitcasts.com • http://whygitisbetterthanx.com/ • http://delicious.com/stevenharman/git
  • 21. fork these slides from http://github.com/stevenharman/git-workflows steven harman twitter: stevenharman http://stevenharman.net

Notas do Editor

  1. \n
  2. git is awesome - if you’re using it, you know. if not, don’t be scared, give it a try.\n
  3. don’t be scared, it’s not as bad as it looks.\n
  4. \n
  5. let’s assume there already exists a Git repository somewhere in the cloud. like maybe... The GitHub.\n
  6. start by cloning a copy of that remote repository (conventionally known as “origin”) to our local machine.\n
  7. we need to work a sweet new feature. step 1) create a local branch to work in. step 2) hackity-hack-hack. step 3) commit the changes. [repeat steps 2 & 3 as necessary]\n
  8. a teammate, or maybe even another you, has pushed some new changes.\n
  9. [still continuing steps 2 & 3 from earlier]\n
  10. get any new changes that are on the remote, but not local.\n
  11. merge the changes from the remote “master” branch into our local “master” branch. because there are no divergent changes on our local master, this is a “fast-forward merge” along the master’s graph.\n
  12. now we need to merge our feature into “master” so we can release it. \n\noption 1) merge feature in. [keeps all info, but we end up with a noisy history graph that’s hard to follow]\n
  13. OR [go back to just after we merged in the fetched changes]\n
  14. option 2) rebase our “feature” branch on top of “master”.\n\nthis “rewinds” our branch back to where it started, then “fast-forwards” along “master”, and finally re-applies each of our change sets. afterward, our local commits have a new SHA1 hash, meaning they are different objects than before rebase, however, the original committer info & meta-data are preserved.\n
  15. now we can merge our changes into “master.” because we already have all of the changes that exist in “master,” this results in a “fast-forward” merge onto “master”.\n
  16. finally we share our sweet, sweet bacon with the rest of the world by pushing our local changes to the remote (origin).\n
  17. now everyone can enjoy the bacony-goodness!\n
  18. \n
  19. add -p to interactively stage hunks of a file change.\n
  20. \n
  21. feel free to hit me up with any questions.\n