SlideShare uma empresa Scribd logo
1 de 41
Baixar para ler offline
GIT Introduction
      Raiful Hasan
   DIVINE IT LIMITED
Objective




       •    Understand the advantage of GIT and determine if we should use GIT or not.

           Know how to use the common used GIT commands




12/12/201                                    2
Subject


        Characteristic of GIT
             – The most powerful features of GIT

             – Explain the differences between GIT and SVN

     • GIT basic usages

             - Day to day GIT used commands
     •   Resources




12/12/2012                                    3
Characteristic of GIT




12/12/2012           4
History


        Invented by Linus Torvalds to support the development of the Linux Kernel

        Incredibly fast, very efficient with large projects, has an incredible branching system
         for non-linear development

     •   Projects using Git : Linux Kernel, Perl, Eclipse, Android ...




12/12/2012                                      5
Compare to SVN



        There are many version control tools in the market But GIT is a completely difference
         tool GIT own many distinct, powerful features

     •   Interface is fairly similar to SVN
     •   Git stores and thinks about data differently than SVN




12/12/2012                                    6
Compare to SVN(cont..)

SVN Data Model:
                                               GIT Data Model:
SVN store history as a list of file-based
                                               Database addressable by the hash value of its
  changes
                                               contents




12/12/2012                                 7
Compare to SVN(cont..)

    Repository
       GIT - Local and multi Remote Repositories

              SVN – only 1 repository on server

    •   SVN may loose history in some case, Git doesn't




12/12/2012                                  8
Compare to SVN(cont..)


     5 Fundamental differences between GIT & SVN
     1.      GIT is distributed, SVN is not
     2.      GIT stores content as metadata, SVN stores just files
     3.      GIT branches are much more easier & fun is not the same as SVN branches.
     4.      GIT does not have a global revision no. like SVN do
     5.      GIT’s content integrity (using SHA-1 hash algorithm) is better than SVN’s.




12/12/2012                                    9
Why's GIT fast ?


     •   The internal database structure
        Nearly every operation is Local. Entire history is on local disk

        This database is compressed effectively transfer over network, use SSH or GIT
         protocol




12/12/2012                                     10
State


     •   States : untracked, modified, and staged, committed



                                              File Status Lifestyle

             Untracked                  Unmodified                   Modified                    Staged

                                                     Edit the File

                         Add the File
                                                                                Stage the File

                         Remove the File
                                                                      Commit




12/12/2012                                           11
Working Area


   •   The Git directory, the working directory, and the staging area.


                                               Local Operation
                     Working                                             Git Directory
                                                Staging Area
                     Directory                                           (repository)


                                               Checkout the Project



                                 Stage Files

                                                                Commit




12/12/2012                                       12
Branch Management


        Killer feature – Managing branches. Make Git apart in the VCS community

        Branching operations nearly instantaneous. Switching back and forth between
         branches just as fast

        We can create branches, and merge often even multiple times in a day




12/12/2012                                  13
Switch Branch

                                                     Point to Current Branch   HEAD


                                                                               master


                                             98ca9             34ac2           f30ab

                              master
                                                                               testing

      98ca9    34ac2          f30ab


                              testing



              Switch Branch   HEAD




12/12/2012                              14
FastForward Merge

                     HEAD


                     master


   98ca9     34ac2   f30ab         c2b9e


                                   testing                           HEAD



                                              Move Pointer Forward   master


                              98ca9          34ac2         f30ab     c2b9e


                                                                     testing




12/12/2012                    15
FastForward Push


        GIT “push” comand equals to svn commit. By default, GIT only allow “FastForward”
         push. To override this, use --force option



                                                                C3
                                                                                    before push

                   C0             C1             C2             C4


                                                              master


                                                                       public repository's master
                                                                            after force push




12/12/2012                                 16
Merge vs. Rebase




12/12/2012        17
Merge vs. Rebase




  Master      C1
             Merge




12/12/2012                18
Merge vs. Rebase




  Master      C2


              C1
             Merge




12/12/2012                19
Merge vs. Rebase




  Master      C3


              C2


              C1
             Merge




12/12/2012                20
Merge vs. Rebase




  Master      C3     C5       Idea



              C2


              C1
             Merge




12/12/2012                     21
Merge vs. Rebase




  Master      C4     C6       Idea



              C3     C5


              C2


              C1
             Merge




12/12/2012                     22
Merge vs. Rebase




  Master      C4     C6       Idea   Master    C4      C6   Idea



              C3     C5                        C3      C5


              C2                               C2


              C1                               C1
             Merge                            Rebase




12/12/2012                      23
Merge vs. Rebase

             Merge Commit

  Master        C7


                C4          C6       Idea   Master    C4      C6   Idea



                C3          C5                        C3      C5


                C2                                    C2


                C1                                    C1
               Merge                                 Rebase




12/12/2012                             24
Merge vs. Rebase
                                                         C4’
             Merge Commit
                                                               2
  Master        C7
                                                         C3’
                                                                   1

                C4          C6       Idea   Master       C4            C6   Idea

                                                     2

                C3          C5                           C3            C5

                                                     1
                C2                                       C2


                C1                                       C1
               Merge                                 Rebase




12/12/2012                             25
Merge vs. Rebase
                                            Master    C4’
             Merge Commit

  Master        C7
                                                      C3’



                C4          C6       Idea   Idea      C6      C4


                C3          C5                        C5      C3


                C2                                    C2


                C1                                    C1
               Merge                                 Rebase




12/12/2012                            26
Push Pull




12/12/2012      27
Push Pull
Computer A




                   Divine Server

                                   Master




                        C1          C2
Computer B




12/12/2012    28
Push Pull
Computer A

             Master                git clone computerA@git.company.com:project.git



  C1          C2
                              Divine Server

                                              Master

       Origin/Master

                                   C1          C2
Computer B




12/12/2012               29
Push Pull
Computer A

             Master




  C1          C2
                             Divine Server

                                             Master

       Origin/Master

                                  C1          C2
Computer B

             Master




  C1          C2




       Origin/Master              git clone computerB@git.company.com:project.git




12/12/2012              30
Push Pull
Computer A

                            Master                    git commit -a -m “ComputerA's new feature"



  C1          C2       a1    a2
                                            Divine Server

                                                            Master

       Origin/Master

                                                 C1          C2
Computer B

             Master




  C1          C2




       Origin/Master




12/12/2012                             31
Push Pull
Computer A

                            Master




  C1         C2        a1    a2
                                           Divine Server

                                                           Master

       Origin/Master

                                                C1          C2
Computer B

                            Master




  C1         C2        b1    b2




       Origin/Master                                 git commit -a -m “ComputerB's new feature"




12/12/2012                            32
Push Pull
Computer A

                            Master




  C1         C2        a1    a2
                                           Divine Server

                                                           Master

       Origin/Master

                                                C1          C2
Computer B

                            Master




  C1         C2        b1    b2




       Origin/Master                                             git push origin master




12/12/2012                            33
Push Pull
Computer A

                                Master




  C1         C2        a1         a2
                                                  Divine Server

                                                                                       Master

       Origin/Master

                                                       C1         C2          b1        b2
Computer B

                                Master




  C1         C2        b1         b2




                            Origin/Master                              git push origin master




12/12/2012                                   34
Push Pull

                                Master                                  git push origin master



  C1         C2        a1         a2
                                                   Divine Server

                                                                                        Master

       Origin/Master

                                                        C1         C2          b1        b2


                                Master




  C1         C2        b1         b2




                            Origin/Master




12/12/2012                                    35
Push Pull

                           Master                                 git fetch



  C1         C2   a1         a2
                                             Divine Server


                  b1         b2                                               Master


                       Origin/Master
                                                  C1         C2   b1           b2


                           Master




  C1         C2   b1         b2




                       Origin/Master




12/12/2012                              36
Push Pull

                                       Master                               git merge origin/master



  C1         C2   a1         a2         a3
                                                       Divine Server


                  b1         b2                                                             Master


                       Origin/Master
                                                            C1         C2          b1         b2


                           Master




  C1         C2   b1         b2




                       Origin/Master




12/12/2012                                        37
Push Pull

                                        Master                                  git push origin master



  C1         C2   a1         a2           a3
                                                           Divine Server


                  b1         b2                                                                          Master

                                    Origin/Master

                                                                C1         C2          b1        b2


                           Master                                                       a1        a2      a3




  C1         C2   b1         b2




                       Origin/Master




12/12/2012                                            38
Git Basics




12/12/2012     39
Installing GIT


     •   Address: http://git-scm.com/download
     •   Window, Mac – Download Installation file
        Linux - The primary Git package :

               git-core, git-doc – document

              git-cvs, git-svn – work with CVS, or SVN

              gitk              – graphical application

     •   $ sudo apt-get install git-core git-doc gitk git-svn




12/12/2012                                      40
Resources


     More explanation why use GIT
     http://whygitisbetterthanx.com




     Basic tutorial
         Version Control with Git - O'Reilly Media “Advance GIT”




12/12/2012                                  41

Mais conteúdo relacionado

Destaque

Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners HubSpot
 
Git vs SVN
Git vs SVNGit vs SVN
Git vs SVNneuros
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to gitJoel Krebs
 

Destaque (6)

Git Presentation
Git PresentationGit Presentation
Git Presentation
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Git vs SVN
Git vs SVNGit vs SVN
Git vs SVN
 
Quick Introduction to git
Quick Introduction to gitQuick Introduction to git
Quick Introduction to git
 

Semelhante a GIT Introduction: Understanding the Advantages and Commands

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_15Chen-Han Hsiao
 
HPLN Meet Git - Public
HPLN Meet Git - PublicHPLN Meet Git - Public
HPLN Meet Git - PublicLiran Tal
 
The Virtual Git Summit - Subversion to Git - A Sugar Story
The Virtual Git Summit - Subversion to Git - A Sugar StoryThe Virtual Git Summit - Subversion to Git - A Sugar Story
The Virtual Git Summit - Subversion to Git - A Sugar StoryJohn Mertic
 
Basics About Git & GitHub
Basics About Git & GitHubBasics About Git & GitHub
Basics About Git & GitHubRaiful Hasan
 
Consolidated shared indexes in real time
Consolidated shared indexes in real timeConsolidated shared indexes in real time
Consolidated shared indexes in real timeJeff Mace
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing selfChen-Tien Tsai
 
Git basics with notes
Git basics with notesGit basics with notes
Git basics with notesSurabhi Gupta
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICLa FeWeb
 
Puppet and Telefonica R&D
Puppet and Telefonica R&DPuppet and Telefonica R&D
Puppet and Telefonica R&DPuppet
 
The 2012 transition from dfm to pdfd leor nevo-intel
The 2012 transition from dfm to pdfd  leor nevo-intelThe 2012 transition from dfm to pdfd  leor nevo-intel
The 2012 transition from dfm to pdfd leor nevo-intelchiportal
 
An Active and Hybrid Storage System for Data-intensive Applications
An Active and Hybrid Storage System for Data-intensive ApplicationsAn Active and Hybrid Storage System for Data-intensive Applications
An Active and Hybrid Storage System for Data-intensive ApplicationsXiao Qin
 
Cloud Computing White Label Offering
Cloud Computing White Label OfferingCloud Computing White Label Offering
Cloud Computing White Label OfferingMichael Rafferty
 
CI/CD patterns for dbt Projects
CI/CD patterns for dbt ProjectsCI/CD patterns for dbt Projects
CI/CD patterns for dbt ProjectsHostedbyConfluent
 
Oracle to MySQL 2012
Oracle to MySQL  2012 Oracle to MySQL  2012
Oracle to MySQL 2012 Marco Tusa
 
BRANCHING MODELS (workshop)
BRANCHING MODELS (workshop)BRANCHING MODELS (workshop)
BRANCHING MODELS (workshop)Drupal Portugal
 

Semelhante a GIT Introduction: Understanding the Advantages and Commands (20)

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
 
HPLN Meet Git - Public
HPLN Meet Git - PublicHPLN Meet Git - Public
HPLN Meet Git - Public
 
Git Tutorial
Git TutorialGit Tutorial
Git Tutorial
 
Session git
Session gitSession git
Session git
 
Git more
Git moreGit more
Git more
 
The Virtual Git Summit - Subversion to Git - A Sugar Story
The Virtual Git Summit - Subversion to Git - A Sugar StoryThe Virtual Git Summit - Subversion to Git - A Sugar Story
The Virtual Git Summit - Subversion to Git - A Sugar Story
 
Basics About Git & GitHub
Basics About Git & GitHubBasics About Git & GitHub
Basics About Git & GitHub
 
Git in Eclipse
Git in EclipseGit in Eclipse
Git in Eclipse
 
Lets git to it
Lets git to itLets git to it
Lets git to it
 
Consolidated shared indexes in real time
Consolidated shared indexes in real timeConsolidated shared indexes in real time
Consolidated shared indexes in real time
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
Git basics with notes
Git basics with notesGit basics with notes
Git basics with notes
 
That's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETICThat's (g)it! par Sébastien Dawans CETIC
That's (g)it! par Sébastien Dawans CETIC
 
Puppet and Telefonica R&D
Puppet and Telefonica R&DPuppet and Telefonica R&D
Puppet and Telefonica R&D
 
The 2012 transition from dfm to pdfd leor nevo-intel
The 2012 transition from dfm to pdfd  leor nevo-intelThe 2012 transition from dfm to pdfd  leor nevo-intel
The 2012 transition from dfm to pdfd leor nevo-intel
 
An Active and Hybrid Storage System for Data-intensive Applications
An Active and Hybrid Storage System for Data-intensive ApplicationsAn Active and Hybrid Storage System for Data-intensive Applications
An Active and Hybrid Storage System for Data-intensive Applications
 
Cloud Computing White Label Offering
Cloud Computing White Label OfferingCloud Computing White Label Offering
Cloud Computing White Label Offering
 
CI/CD patterns for dbt Projects
CI/CD patterns for dbt ProjectsCI/CD patterns for dbt Projects
CI/CD patterns for dbt Projects
 
Oracle to MySQL 2012
Oracle to MySQL  2012 Oracle to MySQL  2012
Oracle to MySQL 2012
 
BRANCHING MODELS (workshop)
BRANCHING MODELS (workshop)BRANCHING MODELS (workshop)
BRANCHING MODELS (workshop)
 

Último

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 

Último (20)

unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 

GIT Introduction: Understanding the Advantages and Commands

  • 1. GIT Introduction Raiful Hasan DIVINE IT LIMITED
  • 2. Objective • Understand the advantage of GIT and determine if we should use GIT or not.  Know how to use the common used GIT commands 12/12/201 2
  • 3. Subject  Characteristic of GIT – The most powerful features of GIT – Explain the differences between GIT and SVN • GIT basic usages - Day to day GIT used commands • Resources 12/12/2012 3
  • 5. History  Invented by Linus Torvalds to support the development of the Linux Kernel  Incredibly fast, very efficient with large projects, has an incredible branching system for non-linear development • Projects using Git : Linux Kernel, Perl, Eclipse, Android ... 12/12/2012 5
  • 6. Compare to SVN  There are many version control tools in the market But GIT is a completely difference tool GIT own many distinct, powerful features • Interface is fairly similar to SVN • Git stores and thinks about data differently than SVN 12/12/2012 6
  • 7. Compare to SVN(cont..) SVN Data Model: GIT Data Model: SVN store history as a list of file-based Database addressable by the hash value of its changes contents 12/12/2012 7
  • 8. Compare to SVN(cont..) Repository  GIT - Local and multi Remote Repositories SVN – only 1 repository on server • SVN may loose history in some case, Git doesn't 12/12/2012 8
  • 9. Compare to SVN(cont..) 5 Fundamental differences between GIT & SVN 1. GIT is distributed, SVN is not 2. GIT stores content as metadata, SVN stores just files 3. GIT branches are much more easier & fun is not the same as SVN branches. 4. GIT does not have a global revision no. like SVN do 5. GIT’s content integrity (using SHA-1 hash algorithm) is better than SVN’s. 12/12/2012 9
  • 10. Why's GIT fast ? • The internal database structure  Nearly every operation is Local. Entire history is on local disk  This database is compressed effectively transfer over network, use SSH or GIT protocol 12/12/2012 10
  • 11. State • States : untracked, modified, and staged, committed File Status Lifestyle Untracked Unmodified Modified Staged Edit the File Add the File Stage the File Remove the File Commit 12/12/2012 11
  • 12. Working Area • The Git directory, the working directory, and the staging area. Local Operation Working Git Directory Staging Area Directory (repository) Checkout the Project Stage Files Commit 12/12/2012 12
  • 13. Branch Management  Killer feature – Managing branches. Make Git apart in the VCS community  Branching operations nearly instantaneous. Switching back and forth between branches just as fast  We can create branches, and merge often even multiple times in a day 12/12/2012 13
  • 14. Switch Branch Point to Current Branch HEAD master 98ca9 34ac2 f30ab master testing 98ca9 34ac2 f30ab testing Switch Branch HEAD 12/12/2012 14
  • 15. FastForward Merge HEAD master 98ca9 34ac2 f30ab c2b9e testing HEAD Move Pointer Forward master 98ca9 34ac2 f30ab c2b9e testing 12/12/2012 15
  • 16. FastForward Push  GIT “push” comand equals to svn commit. By default, GIT only allow “FastForward” push. To override this, use --force option C3 before push C0 C1 C2 C4 master public repository's master after force push 12/12/2012 16
  • 18. Merge vs. Rebase Master C1 Merge 12/12/2012 18
  • 19. Merge vs. Rebase Master C2 C1 Merge 12/12/2012 19
  • 20. Merge vs. Rebase Master C3 C2 C1 Merge 12/12/2012 20
  • 21. Merge vs. Rebase Master C3 C5 Idea C2 C1 Merge 12/12/2012 21
  • 22. Merge vs. Rebase Master C4 C6 Idea C3 C5 C2 C1 Merge 12/12/2012 22
  • 23. Merge vs. Rebase Master C4 C6 Idea Master C4 C6 Idea C3 C5 C3 C5 C2 C2 C1 C1 Merge Rebase 12/12/2012 23
  • 24. Merge vs. Rebase Merge Commit Master C7 C4 C6 Idea Master C4 C6 Idea C3 C5 C3 C5 C2 C2 C1 C1 Merge Rebase 12/12/2012 24
  • 25. Merge vs. Rebase C4’ Merge Commit 2 Master C7 C3’ 1 C4 C6 Idea Master C4 C6 Idea 2 C3 C5 C3 C5 1 C2 C2 C1 C1 Merge Rebase 12/12/2012 25
  • 26. Merge vs. Rebase Master C4’ Merge Commit Master C7 C3’ C4 C6 Idea Idea C6 C4 C3 C5 C5 C3 C2 C2 C1 C1 Merge Rebase 12/12/2012 26
  • 28. Push Pull Computer A Divine Server Master C1 C2 Computer B 12/12/2012 28
  • 29. Push Pull Computer A Master git clone computerA@git.company.com:project.git C1 C2 Divine Server Master Origin/Master C1 C2 Computer B 12/12/2012 29
  • 30. Push Pull Computer A Master C1 C2 Divine Server Master Origin/Master C1 C2 Computer B Master C1 C2 Origin/Master git clone computerB@git.company.com:project.git 12/12/2012 30
  • 31. Push Pull Computer A Master git commit -a -m “ComputerA's new feature" C1 C2 a1 a2 Divine Server Master Origin/Master C1 C2 Computer B Master C1 C2 Origin/Master 12/12/2012 31
  • 32. Push Pull Computer A Master C1 C2 a1 a2 Divine Server Master Origin/Master C1 C2 Computer B Master C1 C2 b1 b2 Origin/Master git commit -a -m “ComputerB's new feature" 12/12/2012 32
  • 33. Push Pull Computer A Master C1 C2 a1 a2 Divine Server Master Origin/Master C1 C2 Computer B Master C1 C2 b1 b2 Origin/Master git push origin master 12/12/2012 33
  • 34. Push Pull Computer A Master C1 C2 a1 a2 Divine Server Master Origin/Master C1 C2 b1 b2 Computer B Master C1 C2 b1 b2 Origin/Master git push origin master 12/12/2012 34
  • 35. Push Pull Master git push origin master C1 C2 a1 a2 Divine Server Master Origin/Master C1 C2 b1 b2 Master C1 C2 b1 b2 Origin/Master 12/12/2012 35
  • 36. Push Pull Master git fetch C1 C2 a1 a2 Divine Server b1 b2 Master Origin/Master C1 C2 b1 b2 Master C1 C2 b1 b2 Origin/Master 12/12/2012 36
  • 37. Push Pull Master git merge origin/master C1 C2 a1 a2 a3 Divine Server b1 b2 Master Origin/Master C1 C2 b1 b2 Master C1 C2 b1 b2 Origin/Master 12/12/2012 37
  • 38. Push Pull Master git push origin master C1 C2 a1 a2 a3 Divine Server b1 b2 Master Origin/Master C1 C2 b1 b2 Master a1 a2 a3 C1 C2 b1 b2 Origin/Master 12/12/2012 38
  • 40. Installing GIT • Address: http://git-scm.com/download • Window, Mac – Download Installation file  Linux - The primary Git package : git-core, git-doc – document git-cvs, git-svn – work with CVS, or SVN gitk – graphical application • $ sudo apt-get install git-core git-doc gitk git-svn 12/12/2012 40
  • 41. Resources More explanation why use GIT http://whygitisbetterthanx.com Basic tutorial Version Control with Git - O'Reilly Media “Advance GIT” 12/12/2012 41