SlideShare una empresa de Scribd logo
1 de 93
Why you should be using




       with very high probability...



                                       Francisco Vieira
What is git?
●   VCS
●   Open source
●   Distributed
●   Offline
●   Fast
●   Flexible
●   Complex
●   Not SVN
Command Glossary
●   Init – Create a repository
●   Clone – Clone a repository (svn checkout)
●   Commit – Offline commit
●   Merge
●   Pull – Download changes from remote repo
    (svn update)
●   Push – Upload changes to remote repo (svn
    does this on each commit)
git is...

DISTRIBUTED
Centralized
Distributed
              Backups


              Offline
              operations


              Fast


              Multiple
              workflows
              possible
Distributed Workflows
      Centralized
Distributed Workflows
      Github-like




          git init
Distributed Workflows
      Github-like




         git clone
Distributed Workflows
      Github-like




         git commit
Distributed Workflows
      Github-like




         git push
Distributed Workflows
      Github-like




         git clone
Distributed Workflows
      Github-like




         git clone
Distributed Workflows
      Github-like




         git commit
Distributed Workflows
      Github-like




         git push
Distributed Workflows
      Github-like




        Pull Request
Distributed Workflows
      Github-like




          git pull
Distributed Workflows
      Github-like




         git push
Distributed Workflows
      Github-like
git has...

A STAGING AREA
Staging Area
Staging Area
Staging Area – Example
Staging Area – Example
git has...

EASY BRANCHING
Branching



2fbc...      3fab...   b99d...
Branching



1       2       3
Branching


                master


1       2         3
Branching

                HEAD

                master


1       2         3
Branching

                          HEAD

                          master


1    2                3     4




         git commit
Branching

                              HEAD

                              master


1    2                   3      4


                              feature




         git branch feature
Branching


                            master


1    2                3       4


                            feature

                            HEAD


     git checkout feature
Branching


                       master



1   2        3           4        5


                                feature


                                HEAD


          git commit
Branching

                               HEAD

                               master



1   2           3                4        5


                                        feature




         git checkout master
Branching
                       HEAD

                       master



                         6



1   2        3           4        5


                                feature



          git commit
Branching
                                 HEAD

                                 master



                             6     7



1   2          3             4     5


                                 feature



         git merge feature
Branching
                                     HEAD

                                     master



                                 6     7



1   2            3               4     5




         git branch -d feature
Tagging

              HEAD

              master


1   2     3     4
Tagging

                           HEAD

                           master


1   2                  3     4


                            v0.1




        git tag v0.1
Tagging
                         HEAD

                         master



                   6       7



1   2      3       4       5


                  v0.1
Tagging

                                   master



                             6       7



1   2         3              4       5


                            v0.1


                            HEAD

        git checkout v0.1
but...

WHY BRANCHING?!
Typical Release Cycle
Typical Release Cycle
Git
flow
Git flow




   git init
Git flow

master



  1




           git commit
Git flow

    master



1     2




               git commit
Git flow

           master



1   2        3




          git commit
Git flow

          master



1   2        3


           v0.1




         git tag v0.1
Git flow

            master



1   2         3           dev


             v0.1




         git branch dev
Git flow

           master      dev



1   2        3         4


            v0.1




          git commit
Git flow

           master          dev



1   2        3         4   5


            v0.1




          git commit
Git flow

             master                 dev



1   2          3              4      5


              v0.1                feature1




        git branch feature1
Git flow
      master           dev


...     3      4        5


       v0.1          feature1
Git flow
      master            dev


...     3      4         5


       v0.1
                         6


                      feature1




                     git commit
Git flow
      master            dev


...     3      4         5


       v0.1
                         6           7


                                  feature1




                     git commit
Git flow
      master                        dev


...     3      4         5           8


       v0.1
                         6           7


                                  feature1




                     git commit
Git flow
      master                      dev


...     3      4         5        8


       v0.1
                         6         7       9


                                        feature1




                     git commit
Git flow
      master                                  dev


...     3      4           5            8     10


       v0.1
                           6            7      9


                                            feature1




                   git merge feature1
Git flow
      master                                    dev


...     3      4             5              8   10


       v0.1
                             6              7   9




                   git branch -d feature1
Git flow



      master


...     3      4       5      8   10   dev


       v0.1
                       6      7   9
Git flow



      master                                     release-v1.0


...     3      4             5               8       10         dev


       v0.1
                             6               7        9


                   git branch release-v1.0
Git flow

                                      release-v1.0



                                          11
      master


...     3      4         5        8       10         dev


       v0.1
                         6        7        9


                     git commit
Git flow
                                      release-v1.0



                                          12



                                          11
      master


...     3      4         5        8       10         dev


       v0.1
                         6        7        9


                     git commit
Git flow
                                      release-v1.0



                                          12



                                          11
      master


...     3      4         5        8       10         13


       v0.1                                          dev
                         6        7        9


                     git commit
Git flow
                                     master    release-v1.0



                                          14       12



                                                   11



...    3     4             5              8        10         13


      v0.1                                                    dev
                           6              7         9


                 git merge release-v1.0
Git flow
                                 master   release-v1.0



                                  14          12


                                  v1.0
                                              11



...    3     4         5           8          10         13


      v0.1                                               dev
                       6           7           9


                  git tag v1.0
Git flow
                                     master    release-v1.0   dev



                                          14       12         15


                                      v1.0
                                                   11



...    3     4             5              8        10         13


      v0.1
                           6              7         9


                 git merge release-v1.0
Git flow
                                    master        dev



                                      14     12   15


                                     v1.0
                                             11



...    3     4           5            8      10   13


      v0.1
                         6            7      9


             git branch -d release-v1.0
Git flow
                            master        dev



                             14      12   15


                             v1.0
                                     11



...    3     4       5        8      10   13


      v0.1
                     6        7      9
Git flow



             master        dev


...    3      14           15
                      12

      v0.1    v1.0

               ...
Git flow



             master                    dev


...    3      14                  15   16
                             12

      v0.1    v1.0

               ...
                git commit
Git flow



             master          hotfix             dev


...    3               14                  15   16
                                      12

      v0.1            v1.0

                       ...
                      git branch hotfix
Git flow


                       17         hotfix
             master                             dev


...    3               14                  15   16
                                      12

      v0.1             v1.0

                       ...
                         git commit
Git flow

                       18         hotfix



                       17
             master                             dev


...    3               14                  15   16
                                      12

      v0.1             v1.0

                       ...
                         git commit
Git flow

             master     18         hotfix



                        17
                                                 dev


...    3                14                  15   16
                                     12

      v0.1             v1.0

                        ...
                       git merge hotfix
Git flow
                       v1.1


             master    18          hotfix



                       17
                                                 dev


...    3               14                   15   16
                                       12

      v0.1             v1.0

                       ...
                        git tag v1.1
Git flow
                       v1.1


             master     18         hotfix
                                                 dev



                        17                       19



...    3                14                  15   16
                                     12

      v0.1             v1.0

                        ...
                       git merge hotfix
Git flow
                        v1.1


             master     18
                                                  dev



                        17                        19



...    3                14                   15   16
                                      12

      v0.1              v1.0

                         ...
                      git branch -d hotfix
Git
flow
Git flow at SAPO
Tópicos extra
●   Repositório local de backup.
●   Mudar de repositorio remoto.
●   Push para dois repositórios diferentes.
●   Corrigir o último commit.
●   Stashing.
●   Rebase.
Merge


master   9ef8           e404   branch   HEAD




         438b           0928



                 a4c6
Merge
                    branch         HEAD


                    2e71


master   9ef8                  e404



         438b                  0928



                    a4c6



                git merge master
Rebase


master   9ef8            e404   branch   HEAD




         438b            0928



                  a4c6
Rebase

                       13d4         branch   HEAD



master   9ef8          a431



         438b



                    a4c6



                git rebase master
GUI Clients
●   git-gui (for commiting) and gitk (for browsing)
●   Github Client (Windows and Osx)
●   SourceTree (Osx)
●   TortoiseGit (Windows)
●   Gitg (Gnome)

●   See more here:
    http://git-scm.com/downloads/guis
References
●   Git flow - http://nvie.com/posts/a-successful-git-branching-model/
●   Pro git book - http://git-scm.com/book
●   Git tutorial - http://gitimmersion.com/
●   Cheat sheet -
    http://media.developerforce.com/cheatsheets/SF_GIT_2Pg_HR_V10.pdf

●   Visual cheatsheet - http://ndpsoftware.com/git-cheatsheet.html
●   GitHub - https://github.com/
●   Heroku - http://www.heroku.com/
Why You Should Be Using Git

Más contenido relacionado

La actualidad más candente

Open Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubOpen Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git Hub
Nick Quaranto
 
Git 101 tutorial presentation
Git 101 tutorial presentationGit 101 tutorial presentation
Git 101 tutorial presentation
Terry Wang
 

La actualidad más candente (19)

Did you git yet?
Did you git yet?Did you git yet?
Did you git yet?
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Open Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git HubOpen Source Collaboration With Git And Git Hub
Open Source Collaboration With Git And Git Hub
 
Git advanced
Git advancedGit advanced
Git advanced
 
Git 101 tutorial presentation
Git 101 tutorial presentationGit 101 tutorial presentation
Git 101 tutorial presentation
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Source control management
Source control managementSource control management
Source control management
 
Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015Introduction to Git, DrupalCamp LA 2015
Introduction to Git, DrupalCamp LA 2015
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...Introduction To Git For Version Control Architecture And Common Commands Comp...
Introduction To Git For Version Control Architecture And Common Commands Comp...
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
 
Un-split brain MySQL
Un-split brain MySQLUn-split brain MySQL
Un-split brain MySQL
 
Advanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesAdvanced Git: Functionality and Features
Advanced Git: Functionality and Features
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
What is Git | What is GitHub | Git Tutorial | GitHub Tutorial | Devops Tutori...
 
Git Basics Philips
Git Basics PhilipsGit Basics Philips
Git Basics Philips
 

Destacado (7)

Nova Outside Assess Your Watershed Tree Canopy Workshop 2013
Nova Outside Assess Your Watershed Tree Canopy Workshop 2013Nova Outside Assess Your Watershed Tree Canopy Workshop 2013
Nova Outside Assess Your Watershed Tree Canopy Workshop 2013
 
Lighting Presentation
Lighting PresentationLighting Presentation
Lighting Presentation
 
Tree Report Cards: Progress or Poison?
Tree Report Cards: Progress or Poison?Tree Report Cards: Progress or Poison?
Tree Report Cards: Progress or Poison?
 
Urban Tree Canopy Change Assessment for Southern Oahu
Urban Tree Canopy Change Assessment for Southern OahuUrban Tree Canopy Change Assessment for Southern Oahu
Urban Tree Canopy Change Assessment for Southern Oahu
 
Considering Trees in Development Activities
Considering Trees in Development ActivitiesConsidering Trees in Development Activities
Considering Trees in Development Activities
 
Canopy management | Practices & Information
Canopy management | Practices & InformationCanopy management | Practices & Information
Canopy management | Practices & Information
 
Canopy & light
Canopy & light Canopy & light
Canopy & light
 

Similar a Why You Should Be Using Git

Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15
Chen-Han Hsiao
 
Using git in eclipse by Chris Aniszczyk
Using git in eclipse by Chris AniszczykUsing git in eclipse by Chris Aniszczyk
Using git in eclipse by Chris Aniszczyk
EclipseDayParis
 

Similar a Why You Should Be Using Git (20)

Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15
 
Git
GitGit
Git
 
M.Mozūras - git
M.Mozūras - gitM.Mozūras - git
M.Mozūras - git
 
Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android Developer
 
Git for the Android Developer
Git for the Android DeveloperGit for the Android Developer
Git for the Android Developer
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Session git
Session gitSession git
Session git
 
Git
GitGit
Git
 
Git
GitGit
Git
 
インフラエンジニアのためのGit入門
インフラエンジニアのためのGit入門インフラエンジニアのためのGit入門
インフラエンジニアのためのGit入門
 
Git basic
Git basicGit basic
Git basic
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Git
GitGit
Git
 
Git in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)
 
Using git in eclipse by Chris Aniszczyk
Using git in eclipse by Chris AniszczykUsing git in eclipse by Chris Aniszczyk
Using git in eclipse by Chris Aniszczyk
 
The git
The gitThe git
The git
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 

Último

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
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
Earley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
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
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
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?
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
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...
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
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
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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)
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
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
 

Why You Should Be Using Git

Notas del editor

  1. Disable “Take a Break”!!!
  2. - Not something you are going to fully understand in an hour - Don’t try to map your understanding of subversion onto git
  3. - No need for a connection anywhere - (Online) Push and pull - John testa o software em vários sistemas operativos
  4. Setas não representam direcção do tempo. Explicar SHA1 (20 bytes, 40 char)
  5. Git finds merge ancestor automatically Conflict resolution
  6. Atenção à direcção das setas. Porque feature branches: - se os requisitos mudam e uma feature passa a ser desnessesária, o código relativo à feature vai para o lixo. Então e as outras alterações feitas a meio da criação da feature (bug-fixes, pequenas refactorizações)?
  7. Hea
  8. HEAD desnecessária. É onde ocorre a acção (commit, merge, tag).
  9. Branch dev: - Código que vai estar com certeza na próxima release.
  10. Vantagens de ter features em branches: - Permite ao developer trabalhar na feature sem ter que se preocupar muito com o resto do desenvolvimento. - Permite visualizar facilmente todas as modificações que são efectuadas por aquela feature. - Fácil de discartar ideias - Fácil de adiar o lançamento de uma feature para outra release
  11. Só bugfixes no branch release. No dev podemos começar a preparar a próxima release. Este é talvez a altura certa para lançar uma versão beta.
  12. Integrar os bugfixes desta release no desenvolvimento da próxima.
  13. É descoberto um bug em produção que tem que ser resolvido imediatamente! Resolvê-lo no branch dev não serve, há lá alterações que não estão prontas para produção!
  14. Se o hotfix está terminado, qual o próximo passo? merge
  15. Fast-forward Não há commit de merge.
  16. Atenção à direcção das setas. Porque feature branches: - se os requisitos mudam e uma feature passa a ser desnessesária, o código relativo à feature vai para o lixo. Então e as outras alterações feitas a meio da criação da feature (bug-fixes, pequenas refactorizações)?
  17. - Sublime - check_ssl para intra - Intra e github - Commit ammending
  18. SHA mudou Só usar se não tiver sido publicado.