SlideShare ist ein Scribd-Unternehmen logo
1 von 229
Downloaden Sie, um offline zu lesen
Conceitos
                                   Reposit´rio
                                          o
                                  Usando GIT




                                  Git o b´sico
                                         a

                Marcello Henrique, faraohh@gmail.com

                                       Brasil/Goi´s - UFG
                                                 a


                             23 de Outubro de 2008




Marcello Henrique, faraohh@gmail.com                        Git o b´sico
                                                                   a       1 / 84
Conceitos
                                       Reposit´rio
                                              o
                                      Usando GIT




1    Conceitos
       Source Control Manager
       Decentraliza¸˜o
                   ca
       Hist´ria
           o

2    Reposit´rio
            o
       Estrutura
       Objetos

3    Usando GIT
       Comandos
       Branching
       Remotes


    Marcello Henrique, faraohh@gmail.com             Git o b´sico
                                                            a       2 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Conceitos

       Gerenciamento de C´digo Fonte
                         o
               Controle nas mudan¸as dos arquivos
                                   c
               Reposit´rio / base de dados das mudan¸as
                       o                            c
               Diret´rio de trabalho / estado atual
                    o
       Modelo Centralizado
               Servidor: simples base de dados
               Cliente: diret´rio de trabalho & estado
                             o
       Modelo Descentralizado
               Qualquer um pode ser o servidor
               Reposit´rio acoplado ao diret´rio de trabalho
                       o                    o
               Hist´rico completo
                   o
               Trabalho desconectado

   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       3 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Conceitos

       Gerenciamento de C´digo Fonte
                         o
               Controle nas mudan¸as dos arquivos
                                   c
               Reposit´rio / base de dados das mudan¸as
                       o                            c
               Diret´rio de trabalho / estado atual
                    o
       Modelo Centralizado
               Servidor: simples base de dados
               Cliente: diret´rio de trabalho & estado
                             o
       Modelo Descentralizado
               Qualquer um pode ser o servidor
               Reposit´rio acoplado ao diret´rio de trabalho
                       o                    o
               Hist´rico completo
                   o
               Trabalho desconectado

   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       3 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Conceitos

       Gerenciamento de C´digo Fonte
                         o
               Controle nas mudan¸as dos arquivos
                                   c
               Reposit´rio / base de dados das mudan¸as
                       o                            c
               Diret´rio de trabalho / estado atual
                    o
       Modelo Centralizado
               Servidor: simples base de dados
               Cliente: diret´rio de trabalho & estado
                             o
       Modelo Descentralizado
               Qualquer um pode ser o servidor
               Reposit´rio acoplado ao diret´rio de trabalho
                       o                    o
               Hist´rico completo
                   o
               Trabalho desconectado

   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       3 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
´
Arvore de trabalho
    diret´rios
         o
    arquivos




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       4 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
Reposit´rio de conte´do
       o            u
    arquivos




                                                                          a.c
                                                                          v1



   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       5 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
Reposit´rio de conte´do
       o            u
    arquivos
    commits




                                                          meta
                                                          data a.c b.c
                                                               v1 v9



   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       5 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
Reposit´rio de conte´do
       o            u
    arquivos
    commits                                                               E
    ancentrais
                                                                          D




                                                                                               time
                                                                   B              C




                                                                              A




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a           5 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
Directed Acyclic Graph “DAG”



                                                                   H

                                                                   G              E

                                                                   F

                                                                                  D

                                                                          B              C

                                                                                  A



   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a           6 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes

Referencias
     tags




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       7 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
Referencias
     tags                                                          topicA

     branches                                                                     testing

                                                                                                   release

                                                                   H

                                                                   G              E

                                                                   F

                                                                                  D             v1.5.0



                                                                            B               C

                                                                                  A             v1.4.4




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a           7 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
HEAD                                                               HEAD

   atual checkout                                                  topicA

   pontos para branch                                                             testing

                                                                                                   release

                                                                   H

                                                                   G              E

                                                                   F

                                                                                  D             v1.5.0



                                                                            B               C

                                                                                  A             v1.4.4




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a           7 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
HEAD                                                               HEAD

   atual checkout                                                      topicA


   pontos para branch                                                             testing

                                                                                                   release
   muitas vezes solto                                              H

                                                                   G              E

                                                                   F

                                                                                  D             v1.5.0



                                                                          B                 C

                                                                                  A             v1.4.4




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a           7 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM componentes
´
Indice                                                             HEAD


     “staging area”                                                topicA


     O que est´ para ser
               a                                        index
                                                                                  testing

                                                                                                   release
     comitado                                                      H

                                                                   G              E

                                                                   F

                                                                                  D             v1.5.0



                                                                            B               C

                                                                                  A             v1.4.4




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a           7 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM opera¸˜es I
         co
 Inicializa¸˜o
            ca
       init
       checkout
       branch
 Modifica¸˜o ca
       add, delete, rename
       commit
 Informa¸˜oca
       status
       diff
       log

   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       8 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


SCM opera¸˜es II
         co
 Referˆncias
      e
      tag
      branch




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       9 / 84
Conceitos           Source Control Manager
                                                  Reposit´rio
                                                         o             Decentraliza¸˜o
                                                                                   ca
                                                 Usando GIT            Hist´ria
                                                                           o


SCM Centralizado

                                                           checkout
                                                            update
             topicA
                                                                diff
                          testing
                                                                log
                                           release
                                                            commit
             H

              G           E

              F

                          D             v1.5.0



                      B             C

                          A             v1.4.4




       opera¸˜es requerem servidor
            co
                  ponto de falha, funilamento
   Marcello Henrique, faraohh@gmail.com                                              Git o b´sico
                                                                                            a       10 / 84
Conceitos                                     Source Control Manager
                                                         Reposit´rio
                                                                o                                       Decentraliza¸˜o
                                                                                                                    ca
                                                        Usando GIT                                      Hist´ria
                                                                                                            o


SCM Decentralizado

             topicA

                          testing

                                           release
                                                                                                clone             topicA

                                                                                                                               testing

                                                                                                                                                release

             H                                                                                                    H
             G            E

             F
                                                                                                pull              G

                                                                                                                  F
                                                                                                                               E



                          D             v1.5.0
                                                                                                                               D             v1.5.0



                      B

                          A
                                    C
                                        v1.4.4
                                                                                                push                       B

                                                                                                                               A
                                                                                                                                         C
                                                                                                                                             v1.4.4




                                                             clon




                                                                                                              e
                                                     pull
                                                     push




                                                                                                         clon
                                                                                                         pull

                                                                                                                   h
                                                                 e




                                                                                                                  pus
                                                        topicA

                                                                     testing

                                                                                      release

                                                        H

                                                        G            E

                                                        F

                                                                     D             v1.5.0



                                                                 B             C

                                                                     A             v1.4.4




       qualquer um pode ser o servidor
   Marcello Henrique, faraohh@gmail.com                                                                                                         Git o b´sico
                                                                                                                                                       a       11 / 84
Conceitos    Source Control Manager
                                     Reposit´rio
                                            o      Decentraliza¸˜o
                                                               ca
                                    Usando GIT     Hist´ria
                                                       o


Opera¸oes SCM
     c˜



 Decentralizado
     clone
     pull, fetch
     push




  Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                        a       12 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Decentraliza¸˜o
            ca




       Reposit´rio p´blico
              o     u




   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       13 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Decentraliza¸˜o
            ca


    upstream




                      local




       Fazendo um clone local

   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       13 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Decentraliza¸˜o
            ca


    upstream




                    pristine


       topic A
                          topic B



       Clonar na rede local ´ mais leve
                            e

   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       13 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Decentraliza¸˜o
            ca


    upstream




                    pristine


       topic A
                          topic B



       Empurando mudan¸as entre reposit´rios
                      c                o


   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       13 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Decentraliza¸˜o
            ca


    upstream                                web server




                    pristine


       topic A
                          topic B



       Enviando mudan¸as para servidores p´blicos
                     c                    u


   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       13 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Decentraliza¸˜o
            ca


    upstream                                web server




                    pristine
                                                    another
       topic A
                          topic B



       Compartilhando mudan¸as com redes confi´veis
                           c                 a


   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       13 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Decentraliza¸˜o pode ser bom?
            ca



       Micro commits n˜o intrusivos
                       a
       Opera¸˜o de destacar
            ca
       N˜o h´ pontos simples de falhas
        a a
       Backups s˜o banais
                a




   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       14 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Hist´ria do GIT
    o
       2002
               Linus usa BitKeeper para versionar o Linux
               BK ´ o melhor
                   e
               Desenvolvimento do Linux escala melhor
       April 6, 2005
               Vence a licen¸a do BitMover
                             c
               Linus cria seu pr´prio SCM, “o GIT”
                                o
       April 18, 2005
               GIT pode fundir c´digos, “merge”
                                o
       June 16, 2005
               GIT ´ oficialmente usado para versionar o c´digo do
                   e                                     o
               Linux
       Feb 14, 2007
               GIT 1.5.0 ´ lan¸ado, focando usabilidade
                         e    c
   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       15 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Hist´ria do GIT
    o
       2002
               Linus usa BitKeeper para versionar o Linux
               BK ´ o melhor
                   e
               Desenvolvimento do Linux escala melhor
       April 6, 2005
               Vence a licen¸a do BitMover
                             c
               Linus cria seu pr´prio SCM, “o GIT”
                                o
       April 18, 2005
               GIT pode fundir c´digos, “merge”
                                o
       June 16, 2005
               GIT ´ oficialmente usado para versionar o c´digo do
                   e                                     o
               Linux
       Feb 14, 2007
               GIT 1.5.0 ´ lan¸ado, focando usabilidade
                         e    c
   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       15 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Hist´ria do GIT
    o
       2002
               Linus usa BitKeeper para versionar o Linux
               BK ´ o melhor
                   e
               Desenvolvimento do Linux escala melhor
       April 6, 2005
               Vence a licen¸a do BitMover
                             c
               Linus cria seu pr´prio SCM, “o GIT”
                                o
       April 18, 2005
               GIT pode fundir c´digos, “merge”
                                o
       June 16, 2005
               GIT ´ oficialmente usado para versionar o c´digo do
                   e                                     o
               Linux
       Feb 14, 2007
               GIT 1.5.0 ´ lan¸ado, focando usabilidade
                         e    c
   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       15 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Hist´ria do GIT
    o
       2002
               Linus usa BitKeeper para versionar o Linux
               BK ´ o melhor
                   e
               Desenvolvimento do Linux escala melhor
       April 6, 2005
               Vence a licen¸a do BitMover
                             c
               Linus cria seu pr´prio SCM, “o GIT”
                                o
       April 18, 2005
               GIT pode fundir c´digos, “merge”
                                o
       June 16, 2005
               GIT ´ oficialmente usado para versionar o c´digo do
                   e                                     o
               Linux
       Feb 14, 2007
               GIT 1.5.0 ´ lan¸ado, focando usabilidade
                         e    c
   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       15 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


Hist´ria do GIT
    o
       2002
               Linus usa BitKeeper para versionar o Linux
               BK ´ o melhor
                   e
               Desenvolvimento do Linux escala melhor
       April 6, 2005
               Vence a licen¸a do BitMover
                             c
               Linus cria seu pr´prio SCM, “o GIT”
                                o
       April 18, 2005
               GIT pode fundir c´digos, “merge”
                                o
       June 16, 2005
               GIT ´ oficialmente usado para versionar o c´digo do
                   e                                     o
               Linux
       Feb 14, 2007
               GIT 1.5.0 ´ lan¸ado, focando usabilidade
                         e    c
   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       15 / 84
Conceitos    Source Control Manager
                                      Reposit´rio
                                             o      Decentraliza¸˜o
                                                                ca
                                     Usando GIT     Hist´ria
                                                        o


GIT gets better



       And then realize that nothing is perfect. Git is just
       *closer* to perfect than any other SCM out there.
       −−
       Linus




   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a       16 / 84
Conceitos
                                                                 Estrutura
                                                   Reposit´rio
                                                          o
                                                                 Objetos
                                                  Usando GIT


Estrutura
     repository
          HEAD



          topicA

                       testing

                                        release

          H

          G            E

          F

                       D             v1.5.0



                   B             C

                       A             v1.4.4




                                                   O hist´rico
                                                         o

   Marcello Henrique, faraohh@gmail.com                                      Git o b´sico
                                                                                    a       17 / 84
Conceitos
                                                                     Estrutura
                                                   Reposit´rio
                                                          o
                                                                     Objetos
                                                  Usando GIT


Estrutura
     repository                                          index
          HEAD
                                                     100644   20b024 0   bar
                                                     100644   1d52a6 0   baz
          topicA
                                                     100644   20b024 0   sub/fiz
                       testing                       100644   43dbe0 0   sub/foo
                                        release

          H

          G            E

          F

                       D             v1.5.0



                   B             C

                       A             v1.4.4




                                                       ´
                                                       ındices

   Marcello Henrique, faraohh@gmail.com                                            Git o b´sico
                                                                                          a       17 / 84
Conceitos
                                                                      Estrutura
                                                    Reposit´rio
                                                           o
                                                                      Objetos
                                                   Usando GIT


Estrutura
     repository                                           index                      work tree
          HEAD                                                                          .
                                                      100644   20b024 0   bar           |−− bar
                                                      100644   1d52a6 0   baz
          topicA
                                                      100644   20b024 0   sub/fiz       |−− baz
                       testing                        100644   43dbe0 0   sub/foo       ‘−− sub
                                        release                                            |−− fiz
          H                                                                                ‘−− foo
          G            E

          F

                       D             v1.5.0



                   B             C

                       A             v1.4.4




                                                  arquivos edit´veis
                                                               a

   Marcello Henrique, faraohh@gmail.com                                             Git o b´sico
                                                                                           a         17 / 84
Conceitos
                                                                     Estrutura
                                                   Reposit´rio
                                                          o
                                                                     Objetos
                                                  Usando GIT


Estrutura
     repository                                          index                      work tree
          HEAD                                                                         .
                                                     100644   20b024 0   bar           |−− bar
                                                     100644   1d52a6 0   baz
          topicA
                                                     100644   20b024 0   sub/fiz       |−− baz
                       testing                       100644   43dbe0 0   sub/foo       ‘−− sub
                                        release                                           |−− fiz
          H                                                                               ‘−− foo
          G            E

          F

                       D             v1.5.0



                   B             C

                       A             v1.4.4




                                 “staging”: add, remove, rename

   Marcello Henrique, faraohh@gmail.com                                            Git o b´sico
                                                                                          a         17 / 84
Conceitos
                                                                       Estrutura
                                                     Reposit´rio
                                                            o
                                                                       Objetos
                                                    Usando GIT


Estrutura
     repository                                            index                      work tree
          HEAD                                                                           .
                                                       100644   20b024 0   bar           |−− bar
                                                       100644   1d52a6 0   baz
          topicA
                                                       100644   20b024 0   sub/fiz       |−− baz
                       testing                         100644   43dbe0 0   sub/foo       ‘−− sub
                                        release                                             |−− fiz
          H                                                                                 ‘−− foo
          G            E

          F

                       D             v1.5.0



                   B             C

                       A             v1.4.4




                                                  “committing”: commit


   Marcello Henrique, faraohh@gmail.com                                              Git o b´sico
                                                                                            a         17 / 84
Conceitos
                                                                     Estrutura
                                                   Reposit´rio
                                                          o
                                                                     Objetos
                                                  Usando GIT


Estrutura
     repository                                          index                      work tree
          HEAD                                                                         .
                                                     100644   20b024 0   bar           |−− bar
                                                     100644   1d52a6 0   baz
          topicA
                                                     100644   20b024 0   sub/fiz       |−− baz
                       testing                       100644   43dbe0 0   sub/foo       ‘−− sub
                                        release                                           |−− fiz
          H                                                                               ‘−− foo
          G            E

          F

                       D             v1.5.0



                   B             C

                       A             v1.4.4




               “reading tree”: checkout, read-tree, reset


   Marcello Henrique, faraohh@gmail.com                                            Git o b´sico
                                                                                          a         17 / 84
Conceitos
                                                                     Estrutura
                                                   Reposit´rio
                                                          o
                                                                     Objetos
                                                  Usando GIT


Estrutura
     repository                                          index                      work tree
          HEAD                                                                         .
                                                     100644   20b024 0   bar           |−− bar
                                                     100644   1d52a6 0   baz
          topicA
                                                     100644   20b024 0   sub/fiz       |−− baz
                       testing                       100644   43dbe0 0   sub/foo       ‘−− sub
                                        release                                           |−− fiz
          H                                                                               ‘−− foo
          G            E

          F

                       D             v1.5.0



                   B             C

                       A             v1.4.4




       “checking out”: checkout, checkout-index, reset


   Marcello Henrique, faraohh@gmail.com                                            Git o b´sico
                                                                                          a         17 / 84
Conceitos
                                                 Estrutura
                                   Reposit´rio
                                          o
                                                 Objetos
                                  Usando GIT


O reposit´rio
         o
    .git
    |-- HEAD                         referˆncia atual do checkout
                                          e
    |-- config                       arquivo de configura¸˜o do reposit´rio
                                                          ca              o
    |-- description                  arquivo de descri¸˜o do reposit´rio
                                                      ca              o
    |-- hooks
    |      ‘-- ...                   scripts de ganchos
    |-- index                        mudan¸as para commit
                                            c
    |-- info
    |      |-- exclude               configura¸˜o de arquivos para n˜o versionamento
                                               ca                      a
    |      ‘-- refs                  refs?
    |-- logs
    |      ‘-- ...                   “reflog” dados
    |-- objects
    |      |-- XX
    |      |    ‘-- ...              objetos perdidos
    |      |-- info
    |      |    ‘-- packs            informa¸oes sobre pacotes
                                             c˜
    |      ‘-- pack
    |           ‘-- ...              pacotes e ´ındeces
    ‘-- refs
           |-- heads
           |    ‘-- master           ramo master
   Marcello‘-- tags
            Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a     18 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


O reposit´rio
         o


  .git/config
       Configura¸˜o do reposit´rio
               ca            o
  .git/description
       Descri¸˜o do reposit´rio
             ca            o
       Muito usado pelo gitweb
  .git/info/exclude
       Padr˜es para ignorar arquivos
           o




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       19 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
 .git/objects
 |--   23
 |     ‘-- d4bd826aba9e29aaace9411cc175b784edc399
 |--   76
 |     ‘-- 49f82d40a98b1ba59057798e47aab2a99a11d3
 |--   c4
 |     ‘-- aaefaa8a48ad4ad379dc1002b78f1a3e4ceabc
 |--   e7
 |     ‘-- 4be61128eef713459ca4e32398d689fe80864e
 |--   info
 |     ‘-- packs
 ‘--   pack
       |-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.idx
       ‘-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.pack



   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       20 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
 .git/objects
 |--   23
 |     ‘-- d4bd826aba9e29aaace9411cc175b784edc399
 |--   76
 |     ‘-- 49f82d40a98b1ba59057798e47aab2a99a11d3
 |--   c4
 |     ‘-- aaefaa8a48ad4ad379dc1002b78f1a3e4ceabc
 |--   e7
 |     ‘-- 4be61128eef713459ca4e32398d689fe80864e
 |--   info
 |     ‘-- packs
 ‘--   pack
       |-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.idx
       ‘-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.pack

                                   “Objetos perdidos”
   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       21 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
 .git/objects
 |--   23
 |     ‘-- d4bd826aba9e29aaace9411cc175b784edc399
 |--   76
 |     ‘-- 49f82d40a98b1ba59057798e47aab2a99a11d3
 |--   c4
 |     ‘-- aaefaa8a48ad4ad379dc1002b78f1a3e4ceabc
 |--   e7
 |     ‘-- 4be61128eef713459ca4e32398d689fe80864e
 |--   info
 |     ‘-- packs
 ‘--   pack
       |-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.idx
       ‘-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.pack

                                          “pack arquivo”
   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       22 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
Conte´do endere¸´vel
     u         ca


                                                                  type          size

                                                                         data




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a        23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
Conte´do endere¸´vel
     u         ca


                                                                     type           size

                                                                            data




                                                                             SHA1
                                                            52a0ff44aba8599f43a5d821c421af316cb7305




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a         23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
Conte´do endere¸´vel
     u         ca


                                                                     type          size

                                                                            data




                                                            52a0ff44aba8599f43a5d821c421af316cb7305




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a         23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos

Conte´do endere¸´vel
     u         ca




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
4 Tipos
    Blobs
                                                                "blob"            size

                                                                      file data




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a          23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
4 Tipos
    Blobs
    Trees                                                                 "tree"          size

                                                                      040000 tree 205f6b... somedir
                                                                      100644 blob 9daeaf... somefile




                                                           "tree"          size

                                                        040000 blob 257cc5... other




   Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                               a           23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
4 Tipos
    Blobs
    Trees                                                                  "tree"         size

                                                                      040000 tree 205f6b... somedir
                                                                      100644 blob 9daeaf... somefile




                                                           "tree"          size           "blob"             size

                                                        040000 blob 257cc5... other              file data




   Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                               a           23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
4 Tipos
    Blobs
    Trees                                                                   "tree"         size

                                                                       040000 tree 205f6b... somedir
                                                                       100644 blob 9daeaf... somefile




                                                           "tree"            size          "blob"             size

                                                        040000 blob 257cc5... other               file data




                                                         "blob"             size

                                                                file data




   Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                               a            23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
4 Tipos
    Blobs
    Trees                                                              "commit"                 size

    Commits                                                           tree cad6ae...
                                                                      parent 6f0104...
                                                                      author Someone <address>
                                                                      comitter Another <address>
                                                                      commit message




                                                                              "tree"           size

                                                                           040000 tree 205f6b... somedir
                                                                           100644 blob 9daeaf... somefile




                                                           "tree"          size                  "blob"            size

                                                        040000 blob 257cc5... other                    file data




                                                         "blob"           size
   Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                               a                  23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
4 Tipos                                                            "commit"                                             size

                                                                tree cad6ae...



    Blobs
                                                                parent 6f0104...
                                                                author Someone <address>
                                                                comitter Another <address>
                                                                commit message




    Trees
                                                                            "tree"           size

                                                                         040000 tree 205f6b... somedir
                                                                         100644 blob 9daeaf... somefile




                                                         "tree"          size

                                                      040000 blob 257cc5... other
                                                                                               "blob"

                                                                                                     file data
                                                                                                                 size
                                                                                                                                "commit"                                        size

    Commits
                                                       "blob"           size

                                                            file data



                                                                                                                               tree cad6ae...
                                                                                                                               parent 6f0104...
                                                                                                                               author Someone <address>
                                                                                                                               comitter Another <address>
                                                                                                                               commit message


                                                                                                                                                      "tree"           size

                                                                                                                                                   040000 tree 205f6b... somedir
                                                                                                                                                   100644 blob 9daeaf... somefile




                                                                                                                                   "tree"          size                  "blob"            size

                                                                                                                                040000 blob 257cc5... other                    file data




                                                                                                                                 "blob"           size

                                                                                                                                      file data




   Marcello Henrique, faraohh@gmail.com                                                                                         Git o b´sico
                                                                                                                                       a                                            23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
4 Tipos
    Blobs
    Trees
    Commits




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos
4 Tipos                                                            "commit"                                             size                             "commit"                                size

                                                                tree cad6ae...                                                                          tree cad6ae...



    Blobs
                                                                parent 6f0104...                                                                        parent 6f0104...
                                                                author Someone <address>                                                                author Someone <address>
                                                                comitter Another <address>                                                              comitter Another <address>
                                                                commit message                                                                          commit message




    Trees
                                                                            "tree"           size                                                                                        "tree"           size

                                                                         040000 tree 205f6b... somedir                                                                                040000 tree 205f6b... somedir
                                                                         100644 blob 9daeaf... somefile                                                                               100644 blob 9daeaf... somefile




                                                         "tree"          size

                                                      040000 blob 257cc5... other
                                                                                               "blob"

                                                                                                     file data
                                                                                                                 size
                                                                                                                                  "tag"          size                 "tree"          size

                                                                                                                                                                   040000 blob 257cc5... other
                                                                                                                                                                                                            "blob"

                                                                                                                                                                                                                  file data
                                                                                                                                                                                                                              size




    Commits
                                                       "blob"           size                                                                                        "blob"           size

                                                            file data                                                                                                    file data



                                                                                                                               object cad6ae...
                                                                                                                               type commit
                                                                                                                               tag tag−name
    Tags                                                                                                                       tagger Who <address> + date
                                                                                                                               tag message




   Marcello Henrique, faraohh@gmail.com                                                                                         Git o b´sico
                                                                                                                                       a          23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos

Imut´vel
    a

                                                                type          size

                                                                       data




   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a           23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos

Imut´vel
    a

                                                                type           size

                                                                       data




                                                                type           size

                                                                       data’




   Marcello Henrique, faraohh@gmail.com                           Git o b´sico
                                                                         a            23 / 84
Conceitos
                                                    Estrutura
                                      Reposit´rio
                                             o
                                                    Objetos
                                     Usando GIT


Objetos

Imut´vel
    a

                                                                   type            size

                                                                          data




                                                                   type            size

                                                                          data’




                                                                            SHA1
                                                         8a9fd66b8bb939638564ebfdecc23b5d58070fc8




   Marcello Henrique, faraohh@gmail.com                               Git o b´sico
                                                                             a                23 / 84
Conceitos    Comandos
                                        Reposit´rio
                                               o      Branching
                                       Usando GIT     Remotes


Comandos
Sintaxe




   ° git <options> <command> <options>




     Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                         a       24 / 84
Conceitos     Comandos
                                   Reposit´rio
                                          o       Branching
                                  Usando GIT      Remotes
add                 fast-export           merge-one-file      revert
am                  fast-import           merge-resolve       rm
annotate            fetch                 merge-subtree       send-email
apply               fetch-pack            merge-tree          send-pack
archimport          filter-branch         mergetool           sh-setup
archive             fmt-merge-msg         mktag               shell
bisect              for-each-ref          mktree              shortlog
blame               format-patch          mv                  show
branch              fsck                  name-rev            show-branch
bundle              fsck-objects          pack-objects        show-index
cat-file            gc                    pack-redundant      show-ref
check-attr          get-tar-commit-id     pack-refs           stash
check-ref-format    grep                  parse-remote        status
checkout            gui                   patch-id            stripspace
checkout-index      hash-object           peek-remote         submodule
cherry              http-fetch            prune               svn
cherry-pick         http-push             prune-packed        symbolic-ref
citool              imap-send             pull                tag
clean               index-pack            push                tar-tree
clone               init                  quiltimport         unpack-file
commit              init-db               read-tree           unpack-objects
commit-tree         instaweb              rebase              update-index
config              log                   receive-pack        update-ref
count-objects       lost-found            reflog              update-server-info
cvsexportcommit     ls-files              relink              upload-archive
cvsimport           ls-remote             remote              upload-pack
cvsserver           ls-tree               repack              var
daemon              mailinfo              repo-config         verify-pack
describe            mailsplit             request-pull        verify-tag
diff                merge                 rerere              whatchanged
diff-files          merge-base            reset               write-tree
diff-index          merge-file            rev-list
diff-tree           merge-index           rev-parse           gitk

Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                            a       25 / 84
Conceitos     Comandos
                                   Reposit´rio
                                          o       Branching
                                  Usando GIT      Remotes
add                 fast-export           merge-one-file      revert
am                  fast-import           merge-resolve       rm
annotate            fetch                 merge-subtree       send-email
apply               fetch-pack            merge-tree          send-pack
archimport          filter-branch         mergetool           sh-setup
archive             fmt-merge-msg         mktag               shell
bisect              for-each-ref          mktree              shortlog
blame               format-patch          mv                  show
branch              fsck                  name-rev            show-branch
bundle              fsck-objects          pack-objects        show-index
cat-file            gc                    pack-redundant      show-ref
check-attr          get-tar-commit-id     pack-refs           stash
check-ref-format    grep                  parse-remote        status
checkout            gui                   patch-id            stripspace
checkout-index      hash-object           peek-remote         submodule
cherry              http-fetch            prune               svn
cherry-pick         http-push             prune-packed        symbolic-ref
citool              imap-send             pull                tag
clean               index-pack            push                tar-tree
clone               init                  quiltimport         unpack-file
commit              init-db               read-tree           unpack-objects
commit-tree         instaweb              rebase              update-index
config              log                   receive-pack        update-ref
count-objects       lost-found            reflog              update-server-info
cvsexportcommit     ls-files              relink              upload-archive
cvsimport           ls-remote             remote              upload-pack
cvsserver           ls-tree               repack              var
daemon              mailinfo              repo-config         verify-pack
describe            mailsplit             request-pull        verify-tag
diff                merge                 rerere              whatchanged
diff-files          merge-base            reset               write-tree
diff-index          merge-file            rev-list
diff-tree           merge-index           rev-parse           gitk

Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                            a       26 / 84
Conceitos     Comandos
                                   Reposit´rio
                                          o       Branching
                                  Usando GIT      Remotes
add                 fast-export           merge-one-file      revert
am                  fast-import           merge-resolve       rm
annotate            fetch                 merge-subtree       send-email
apply               fetch-pack            merge-tree          send-pack
archimport          filter-branch         mergetool           sh-setup
archive             fmt-merge-msg         mktag               shell
bisect              for-each-ref          mktree              shortlog
blame               format-patch          mv                  show
branch              fsck                  name-rev            show-branch
bundle              fsck-objects          pack-objects        show-index
cat-file            gc                    pack-redundant      show-ref
check-attr          get-tar-commit-id     pack-refs           stash
check-ref-format    grep                  parse-remote        status
checkout            gui                   patch-id            stripspace
checkout-index      hash-object           peek-remote         submodule
cherry              http-fetch            prune               svn
cherry-pick         http-push             prune-packed        symbolic-ref
citool              imap-send             pull                tag
clean               index-pack            push                tar-tree
clone               init                  quiltimport         unpack-file
commit              init-db               read-tree           unpack-objects
commit-tree         instaweb              rebase              update-index
config              log                   receive-pack        update-ref
count-objects       lost-found            reflog              update-server-info
cvsexportcommit     ls-files              relink              upload-archive
cvsimport           ls-remote             remote              upload-pack
cvsserver           ls-tree               repack              var
daemon              mailinfo              repo-config         verify-pack
describe            mailsplit             request-pull        verify-tag
diff                merge                 rerere              whatchanged
diff-files          merge-base            reset               write-tree
diff-index          merge-file            rev-list
diff-tree           merge-index           rev-parse           gitk

Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                            a       27 / 84
Conceitos     Comandos
                                   Reposit´rio
                                          o       Branching
                                  Usando GIT      Remotes
add                 fast-export           merge-one-file      revert
am                  fast-import           merge-resolve       rm
annotate            fetch                 merge-subtree       send-email
apply               fetch-pack            merge-tree          send-pack
archimport          filter-branch         mergetool           sh-setup
archive             fmt-merge-msg         mktag               shell
bisect              for-each-ref          mktree              shortlog
blame               format-patch          mv                  show
branch              fsck                  name-rev            show-branch
bundle              fsck-objects          pack-objects        show-index
cat-file            gc                    pack-redundant      show-ref
check-attr          get-tar-commit-id     pack-refs           stash
check-ref-format    grep                  parse-remote        status
checkout            gui                   patch-id            stripspace
checkout-index      hash-object           peek-remote         submodule
cherry              http-fetch            prune               svn
cherry-pick         http-push             prune-packed        symbolic-ref
citool              imap-send             pull                tag
clean               index-pack            push                tar-tree
clone               init                  quiltimport         unpack-file
commit              init-db               read-tree           unpack-objects
commit-tree         instaweb              rebase              update-index
config              log                   receive-pack        update-ref
count-objects       lost-found            reflog              update-server-info
cvsexportcommit     ls-files              relink              upload-archive
cvsimport           ls-remote             remote              upload-pack
cvsserver           ls-tree               repack              var
daemon              mailinfo              repo-config         verify-pack
describe            mailsplit             request-pull        verify-tag
diff                merge                 rerere              whatchanged
diff-files          merge-base            reset               write-tree
diff-index          merge-file            rev-list
diff-tree           merge-index           rev-parse           gitk

Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                            a       28 / 84
Conceitos     Comandos
                                   Reposit´rio
                                          o       Branching
                                  Usando GIT      Remotes
add                 fast-export           merge-one-file      revert
am                  fast-import           merge-resolve       rm
annotate            fetch                 merge-subtree       send-email
apply               fetch-pack            merge-tree          send-pack
archimport          filter-branch         mergetool           sh-setup
archive             fmt-merge-msg         mktag               shell
bisect              for-each-ref          mktree              shortlog
blame               format-patch          mv                  show
branch              fsck                  name-rev            show-branch
bundle              fsck-objects          pack-objects        show-index
cat-file            gc                    pack-redundant      show-ref
check-attr          get-tar-commit-id     pack-refs           stash
check-ref-format    grep                  parse-remote        status
checkout            gui                   patch-id            stripspace
checkout-index      hash-object           peek-remote         submodule
cherry              http-fetch            prune               svn
cherry-pick         http-push             prune-packed        symbolic-ref
citool              imap-send             pull                tag
clean               index-pack            push                tar-tree
clone               init                  quiltimport         unpack-file
commit              init-db               read-tree           unpack-objects
commit-tree         instaweb              rebase              update-index
config              log                   receive-pack        update-ref
count-objects       lost-found            reflog              update-server-info
cvsexportcommit     ls-files              relink              upload-archive
cvsimport           ls-remote             remote              upload-pack
cvsserver           ls-tree               repack              var
daemon              mailinfo              repo-config         verify-pack
describe            mailsplit             request-pull        verify-tag
diff                merge                 rerere              whatchanged
diff-files          merge-base            reset               write-tree
diff-index          merge-file            rev-list
diff-tree           merge-index           rev-parse           gitk

Marcello Henrique, faraohh@gmail.com                                 Git o b´sico
                                                                            a       29 / 84
Conceitos    Comandos
                                     Reposit´rio
                                            o      Branching
                                    Usando GIT     Remotes


Comandos de ajuda


 git help
     Lista dos comandos mais comuns
 git <command> -h
     breve ajuda
 man git-<command>
 git help <command>
 git <command> --help
      p´ginas de manual
       a



  Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                      a       30 / 84
Conceitos    Comandos
                                      Reposit´rio
                                             o      Branching
                                     Usando GIT     Remotes


Configura¸˜o do usu´rio
        ca        a


 °HOME/.gitconfig


 ° git config --global user.name "Seu nome"
 ° git config --global user.email usuario@dominio.com


 ° git config --global color.pager true
 ° git config --global color.ui auto




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       31 / 84
Conceitos    Comandos
                                      Reposit´rio
                                             o      Branching
                                     Usando GIT     Remotes


Configura¸˜o do usu´rio
        ca        a


 °HOME/.gitconfig


 ° git config --global user.name "Seu nome"
 ° git config --global user.email usuario@dominio.com


 ° git config --global color.pager true
 ° git config --global color.ui auto




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       31 / 84
Conceitos    Comandos
                                      Reposit´rio
                                             o      Branching
                                     Usando GIT     Remotes


Configura¸˜o do usu´rio
        ca        a

 ° cat .gitconfig
 [user]
               name = "Marcello Henrique"
               email = "faraohh@gmail.com"
 [core]
               pager = less -FRSX
               editor = vim
 [color]
               ui = auto
 [merge]
               tool = vimdiff



   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       32 / 84
Conceitos    Comandos
                                      Reposit´rio
                                             o      Branching
                                     Usando GIT     Remotes


Comando de inicializa¸˜o
                     ca



  ° git init
       cria a ´rea do projeto
              a
       cria o diret´rio .git
                   o




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       33 / 84
Conceitos    Comandos
                                     Reposit´rio
                                            o      Branching
                                    Usando GIT     Remotes


O que commitar?


      adicionar
      ° git add file
      ° git add .
      remover
      ° git rm file
      renomear
      ° git mv old new




  Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                      a       34 / 84
Conceitos    Comandos
                                      Reposit´rio
                                             o      Branching
                                     Usando GIT     Remotes


Ignorar arquivos




  ° cat .gitignore
  *.o
  *~




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       35 / 84
Conceitos    Comandos
                                     Reposit´rio
                                            o      Branching
                                    Usando GIT     Remotes


Como commitar?



 ° git commit -a -m‘‘some comment’’
      Vai criar um commit de tudo ou somente dos itens
      trabalhados (staged)




  Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                      a       36 / 84
Conceitos    Comandos
                                      Reposit´rio
                                             o      Branching
                                     Usando GIT     Remotes


° mkdir project
                                                        HEAD
° cd project
° git init                                             master        index




                                                                                       repository
                                                                                     working tree
                                                      .git




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       37 / 84
Conceitos    Comandos
                                      Reposit´rio
                                             o      Branching
                                     Usando GIT     Remotes


° echo test > test
                                                        HEAD


                                                       master        index




                                                                                       repository
                                                                                     working tree
                                                      .git
                                                      test




   Marcello Henrique, faraohh@gmail.com                         Git o b´sico
                                                                       a       37 / 84
Conceitos    Comandos
                                      Reposit´rio
                                             o      Branching
                                     Usando GIT     Remotes


° echo test > test
                                                        HEAD
° git add test
                                                       master           index




                                                        tree
                                                      52a266...

                                                         blob
                                                       9daefb...   "test"




                                                                                          repository
                                                                                        working tree
                                                      .git
                                                      test




   Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                          a       37 / 84
Conceitos    Comandos
                                        Reposit´rio
                                               o      Branching
                                       Usando GIT     Remotes


° echo test > test
                                                          HEAD
° git add test
                                                         master           index
° git commit -m‘‘test’’
Created initial commit 6f01040: test                      commit
1 files changed, 1 insertions(+), 0 deletions(-)         6f0104...
create mode 100644 test
                                                          tree
                                                        52a266...

                                                           blob
                                                         9daefb...   "test"




                                                                                            repository
                                                                                          working tree
                                                        .git
                                                        test




     Marcello Henrique, faraohh@gmail.com                            Git o b´sico
                                                                            a       37 / 84
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git
Intro To Git

Weitere ähnliche Inhalte

Kürzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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...
 
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
 
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...
 
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)
 
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
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
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
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
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...
 

Empfohlen

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Empfohlen (20)

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
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Intro To Git

  • 1. Conceitos Reposit´rio o Usando GIT Git o b´sico a Marcello Henrique, faraohh@gmail.com Brasil/Goi´s - UFG a 23 de Outubro de 2008 Marcello Henrique, faraohh@gmail.com Git o b´sico a 1 / 84
  • 2. Conceitos Reposit´rio o Usando GIT 1 Conceitos Source Control Manager Decentraliza¸˜o ca Hist´ria o 2 Reposit´rio o Estrutura Objetos 3 Usando GIT Comandos Branching Remotes Marcello Henrique, faraohh@gmail.com Git o b´sico a 2 / 84
  • 3. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Conceitos Gerenciamento de C´digo Fonte o Controle nas mudan¸as dos arquivos c Reposit´rio / base de dados das mudan¸as o c Diret´rio de trabalho / estado atual o Modelo Centralizado Servidor: simples base de dados Cliente: diret´rio de trabalho & estado o Modelo Descentralizado Qualquer um pode ser o servidor Reposit´rio acoplado ao diret´rio de trabalho o o Hist´rico completo o Trabalho desconectado Marcello Henrique, faraohh@gmail.com Git o b´sico a 3 / 84
  • 4. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Conceitos Gerenciamento de C´digo Fonte o Controle nas mudan¸as dos arquivos c Reposit´rio / base de dados das mudan¸as o c Diret´rio de trabalho / estado atual o Modelo Centralizado Servidor: simples base de dados Cliente: diret´rio de trabalho & estado o Modelo Descentralizado Qualquer um pode ser o servidor Reposit´rio acoplado ao diret´rio de trabalho o o Hist´rico completo o Trabalho desconectado Marcello Henrique, faraohh@gmail.com Git o b´sico a 3 / 84
  • 5. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Conceitos Gerenciamento de C´digo Fonte o Controle nas mudan¸as dos arquivos c Reposit´rio / base de dados das mudan¸as o c Diret´rio de trabalho / estado atual o Modelo Centralizado Servidor: simples base de dados Cliente: diret´rio de trabalho & estado o Modelo Descentralizado Qualquer um pode ser o servidor Reposit´rio acoplado ao diret´rio de trabalho o o Hist´rico completo o Trabalho desconectado Marcello Henrique, faraohh@gmail.com Git o b´sico a 3 / 84
  • 6. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes ´ Arvore de trabalho diret´rios o arquivos Marcello Henrique, faraohh@gmail.com Git o b´sico a 4 / 84
  • 7. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes Reposit´rio de conte´do o u arquivos a.c v1 Marcello Henrique, faraohh@gmail.com Git o b´sico a 5 / 84
  • 8. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes Reposit´rio de conte´do o u arquivos commits meta data a.c b.c v1 v9 Marcello Henrique, faraohh@gmail.com Git o b´sico a 5 / 84
  • 9. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes Reposit´rio de conte´do o u arquivos commits E ancentrais D time B C A Marcello Henrique, faraohh@gmail.com Git o b´sico a 5 / 84
  • 10. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes Directed Acyclic Graph “DAG” H G E F D B C A Marcello Henrique, faraohh@gmail.com Git o b´sico a 6 / 84
  • 11. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes Referencias tags Marcello Henrique, faraohh@gmail.com Git o b´sico a 7 / 84
  • 12. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes Referencias tags topicA branches testing release H G E F D v1.5.0 B C A v1.4.4 Marcello Henrique, faraohh@gmail.com Git o b´sico a 7 / 84
  • 13. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes HEAD HEAD atual checkout topicA pontos para branch testing release H G E F D v1.5.0 B C A v1.4.4 Marcello Henrique, faraohh@gmail.com Git o b´sico a 7 / 84
  • 14. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes HEAD HEAD atual checkout topicA pontos para branch testing release muitas vezes solto H G E F D v1.5.0 B C A v1.4.4 Marcello Henrique, faraohh@gmail.com Git o b´sico a 7 / 84
  • 15. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM componentes ´ Indice HEAD “staging area” topicA O que est´ para ser a index testing release comitado H G E F D v1.5.0 B C A v1.4.4 Marcello Henrique, faraohh@gmail.com Git o b´sico a 7 / 84
  • 16. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM opera¸˜es I co Inicializa¸˜o ca init checkout branch Modifica¸˜o ca add, delete, rename commit Informa¸˜oca status diff log Marcello Henrique, faraohh@gmail.com Git o b´sico a 8 / 84
  • 17. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM opera¸˜es II co Referˆncias e tag branch Marcello Henrique, faraohh@gmail.com Git o b´sico a 9 / 84
  • 18. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM Centralizado checkout update topicA diff testing log release commit H G E F D v1.5.0 B C A v1.4.4 opera¸˜es requerem servidor co ponto de falha, funilamento Marcello Henrique, faraohh@gmail.com Git o b´sico a 10 / 84
  • 19. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o SCM Decentralizado topicA testing release clone topicA testing release H H G E F pull G F E D v1.5.0 D v1.5.0 B A C v1.4.4 push B A C v1.4.4 clon e pull push clon pull h e pus topicA testing release H G E F D v1.5.0 B C A v1.4.4 qualquer um pode ser o servidor Marcello Henrique, faraohh@gmail.com Git o b´sico a 11 / 84
  • 20. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Opera¸oes SCM c˜ Decentralizado clone pull, fetch push Marcello Henrique, faraohh@gmail.com Git o b´sico a 12 / 84
  • 21. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Decentraliza¸˜o ca Reposit´rio p´blico o u Marcello Henrique, faraohh@gmail.com Git o b´sico a 13 / 84
  • 22. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Decentraliza¸˜o ca upstream local Fazendo um clone local Marcello Henrique, faraohh@gmail.com Git o b´sico a 13 / 84
  • 23. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Decentraliza¸˜o ca upstream pristine topic A topic B Clonar na rede local ´ mais leve e Marcello Henrique, faraohh@gmail.com Git o b´sico a 13 / 84
  • 24. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Decentraliza¸˜o ca upstream pristine topic A topic B Empurando mudan¸as entre reposit´rios c o Marcello Henrique, faraohh@gmail.com Git o b´sico a 13 / 84
  • 25. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Decentraliza¸˜o ca upstream web server pristine topic A topic B Enviando mudan¸as para servidores p´blicos c u Marcello Henrique, faraohh@gmail.com Git o b´sico a 13 / 84
  • 26. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Decentraliza¸˜o ca upstream web server pristine another topic A topic B Compartilhando mudan¸as com redes confi´veis c a Marcello Henrique, faraohh@gmail.com Git o b´sico a 13 / 84
  • 27. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Decentraliza¸˜o pode ser bom? ca Micro commits n˜o intrusivos a Opera¸˜o de destacar ca N˜o h´ pontos simples de falhas a a Backups s˜o banais a Marcello Henrique, faraohh@gmail.com Git o b´sico a 14 / 84
  • 28. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Hist´ria do GIT o 2002 Linus usa BitKeeper para versionar o Linux BK ´ o melhor e Desenvolvimento do Linux escala melhor April 6, 2005 Vence a licen¸a do BitMover c Linus cria seu pr´prio SCM, “o GIT” o April 18, 2005 GIT pode fundir c´digos, “merge” o June 16, 2005 GIT ´ oficialmente usado para versionar o c´digo do e o Linux Feb 14, 2007 GIT 1.5.0 ´ lan¸ado, focando usabilidade e c Marcello Henrique, faraohh@gmail.com Git o b´sico a 15 / 84
  • 29. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Hist´ria do GIT o 2002 Linus usa BitKeeper para versionar o Linux BK ´ o melhor e Desenvolvimento do Linux escala melhor April 6, 2005 Vence a licen¸a do BitMover c Linus cria seu pr´prio SCM, “o GIT” o April 18, 2005 GIT pode fundir c´digos, “merge” o June 16, 2005 GIT ´ oficialmente usado para versionar o c´digo do e o Linux Feb 14, 2007 GIT 1.5.0 ´ lan¸ado, focando usabilidade e c Marcello Henrique, faraohh@gmail.com Git o b´sico a 15 / 84
  • 30. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Hist´ria do GIT o 2002 Linus usa BitKeeper para versionar o Linux BK ´ o melhor e Desenvolvimento do Linux escala melhor April 6, 2005 Vence a licen¸a do BitMover c Linus cria seu pr´prio SCM, “o GIT” o April 18, 2005 GIT pode fundir c´digos, “merge” o June 16, 2005 GIT ´ oficialmente usado para versionar o c´digo do e o Linux Feb 14, 2007 GIT 1.5.0 ´ lan¸ado, focando usabilidade e c Marcello Henrique, faraohh@gmail.com Git o b´sico a 15 / 84
  • 31. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Hist´ria do GIT o 2002 Linus usa BitKeeper para versionar o Linux BK ´ o melhor e Desenvolvimento do Linux escala melhor April 6, 2005 Vence a licen¸a do BitMover c Linus cria seu pr´prio SCM, “o GIT” o April 18, 2005 GIT pode fundir c´digos, “merge” o June 16, 2005 GIT ´ oficialmente usado para versionar o c´digo do e o Linux Feb 14, 2007 GIT 1.5.0 ´ lan¸ado, focando usabilidade e c Marcello Henrique, faraohh@gmail.com Git o b´sico a 15 / 84
  • 32. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o Hist´ria do GIT o 2002 Linus usa BitKeeper para versionar o Linux BK ´ o melhor e Desenvolvimento do Linux escala melhor April 6, 2005 Vence a licen¸a do BitMover c Linus cria seu pr´prio SCM, “o GIT” o April 18, 2005 GIT pode fundir c´digos, “merge” o June 16, 2005 GIT ´ oficialmente usado para versionar o c´digo do e o Linux Feb 14, 2007 GIT 1.5.0 ´ lan¸ado, focando usabilidade e c Marcello Henrique, faraohh@gmail.com Git o b´sico a 15 / 84
  • 33. Conceitos Source Control Manager Reposit´rio o Decentraliza¸˜o ca Usando GIT Hist´ria o GIT gets better And then realize that nothing is perfect. Git is just *closer* to perfect than any other SCM out there. −− Linus Marcello Henrique, faraohh@gmail.com Git o b´sico a 16 / 84
  • 34. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Estrutura repository HEAD topicA testing release H G E F D v1.5.0 B C A v1.4.4 O hist´rico o Marcello Henrique, faraohh@gmail.com Git o b´sico a 17 / 84
  • 35. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Estrutura repository index HEAD 100644 20b024 0 bar 100644 1d52a6 0 baz topicA 100644 20b024 0 sub/fiz testing 100644 43dbe0 0 sub/foo release H G E F D v1.5.0 B C A v1.4.4 ´ ındices Marcello Henrique, faraohh@gmail.com Git o b´sico a 17 / 84
  • 36. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Estrutura repository index work tree HEAD . 100644 20b024 0 bar |−− bar 100644 1d52a6 0 baz topicA 100644 20b024 0 sub/fiz |−− baz testing 100644 43dbe0 0 sub/foo ‘−− sub release |−− fiz H ‘−− foo G E F D v1.5.0 B C A v1.4.4 arquivos edit´veis a Marcello Henrique, faraohh@gmail.com Git o b´sico a 17 / 84
  • 37. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Estrutura repository index work tree HEAD . 100644 20b024 0 bar |−− bar 100644 1d52a6 0 baz topicA 100644 20b024 0 sub/fiz |−− baz testing 100644 43dbe0 0 sub/foo ‘−− sub release |−− fiz H ‘−− foo G E F D v1.5.0 B C A v1.4.4 “staging”: add, remove, rename Marcello Henrique, faraohh@gmail.com Git o b´sico a 17 / 84
  • 38. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Estrutura repository index work tree HEAD . 100644 20b024 0 bar |−− bar 100644 1d52a6 0 baz topicA 100644 20b024 0 sub/fiz |−− baz testing 100644 43dbe0 0 sub/foo ‘−− sub release |−− fiz H ‘−− foo G E F D v1.5.0 B C A v1.4.4 “committing”: commit Marcello Henrique, faraohh@gmail.com Git o b´sico a 17 / 84
  • 39. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Estrutura repository index work tree HEAD . 100644 20b024 0 bar |−− bar 100644 1d52a6 0 baz topicA 100644 20b024 0 sub/fiz |−− baz testing 100644 43dbe0 0 sub/foo ‘−− sub release |−− fiz H ‘−− foo G E F D v1.5.0 B C A v1.4.4 “reading tree”: checkout, read-tree, reset Marcello Henrique, faraohh@gmail.com Git o b´sico a 17 / 84
  • 40. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Estrutura repository index work tree HEAD . 100644 20b024 0 bar |−− bar 100644 1d52a6 0 baz topicA 100644 20b024 0 sub/fiz |−− baz testing 100644 43dbe0 0 sub/foo ‘−− sub release |−− fiz H ‘−− foo G E F D v1.5.0 B C A v1.4.4 “checking out”: checkout, checkout-index, reset Marcello Henrique, faraohh@gmail.com Git o b´sico a 17 / 84
  • 41. Conceitos Estrutura Reposit´rio o Objetos Usando GIT O reposit´rio o .git |-- HEAD referˆncia atual do checkout e |-- config arquivo de configura¸˜o do reposit´rio ca o |-- description arquivo de descri¸˜o do reposit´rio ca o |-- hooks | ‘-- ... scripts de ganchos |-- index mudan¸as para commit c |-- info | |-- exclude configura¸˜o de arquivos para n˜o versionamento ca a | ‘-- refs refs? |-- logs | ‘-- ... “reflog” dados |-- objects | |-- XX | | ‘-- ... objetos perdidos | |-- info | | ‘-- packs informa¸oes sobre pacotes c˜ | ‘-- pack | ‘-- ... pacotes e ´ındeces ‘-- refs |-- heads | ‘-- master ramo master Marcello‘-- tags Henrique, faraohh@gmail.com Git o b´sico a 18 / 84
  • 42. Conceitos Estrutura Reposit´rio o Objetos Usando GIT O reposit´rio o .git/config Configura¸˜o do reposit´rio ca o .git/description Descri¸˜o do reposit´rio ca o Muito usado pelo gitweb .git/info/exclude Padr˜es para ignorar arquivos o Marcello Henrique, faraohh@gmail.com Git o b´sico a 19 / 84
  • 43. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos .git/objects |-- 23 | ‘-- d4bd826aba9e29aaace9411cc175b784edc399 |-- 76 | ‘-- 49f82d40a98b1ba59057798e47aab2a99a11d3 |-- c4 | ‘-- aaefaa8a48ad4ad379dc1002b78f1a3e4ceabc |-- e7 | ‘-- 4be61128eef713459ca4e32398d689fe80864e |-- info | ‘-- packs ‘-- pack |-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.idx ‘-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.pack Marcello Henrique, faraohh@gmail.com Git o b´sico a 20 / 84
  • 44. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos .git/objects |-- 23 | ‘-- d4bd826aba9e29aaace9411cc175b784edc399 |-- 76 | ‘-- 49f82d40a98b1ba59057798e47aab2a99a11d3 |-- c4 | ‘-- aaefaa8a48ad4ad379dc1002b78f1a3e4ceabc |-- e7 | ‘-- 4be61128eef713459ca4e32398d689fe80864e |-- info | ‘-- packs ‘-- pack |-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.idx ‘-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.pack “Objetos perdidos” Marcello Henrique, faraohh@gmail.com Git o b´sico a 21 / 84
  • 45. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos .git/objects |-- 23 | ‘-- d4bd826aba9e29aaace9411cc175b784edc399 |-- 76 | ‘-- 49f82d40a98b1ba59057798e47aab2a99a11d3 |-- c4 | ‘-- aaefaa8a48ad4ad379dc1002b78f1a3e4ceabc |-- e7 | ‘-- 4be61128eef713459ca4e32398d689fe80864e |-- info | ‘-- packs ‘-- pack |-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.idx ‘-- pack-b7b026b1a0b0f193db9dea0b0d7367d25d3a68cc.pack “pack arquivo” Marcello Henrique, faraohh@gmail.com Git o b´sico a 22 / 84
  • 46. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos Conte´do endere¸´vel u ca type size data Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 47. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos Conte´do endere¸´vel u ca type size data SHA1 52a0ff44aba8599f43a5d821c421af316cb7305 Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 48. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos Conte´do endere¸´vel u ca type size data 52a0ff44aba8599f43a5d821c421af316cb7305 Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 49. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos Conte´do endere¸´vel u ca Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 50. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos 4 Tipos Blobs "blob" size file data Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 51. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos 4 Tipos Blobs Trees "tree" size 040000 tree 205f6b... somedir 100644 blob 9daeaf... somefile "tree" size 040000 blob 257cc5... other Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 52. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos 4 Tipos Blobs Trees "tree" size 040000 tree 205f6b... somedir 100644 blob 9daeaf... somefile "tree" size "blob" size 040000 blob 257cc5... other file data Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 53. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos 4 Tipos Blobs Trees "tree" size 040000 tree 205f6b... somedir 100644 blob 9daeaf... somefile "tree" size "blob" size 040000 blob 257cc5... other file data "blob" size file data Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 54. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos 4 Tipos Blobs Trees "commit" size Commits tree cad6ae... parent 6f0104... author Someone <address> comitter Another <address> commit message "tree" size 040000 tree 205f6b... somedir 100644 blob 9daeaf... somefile "tree" size "blob" size 040000 blob 257cc5... other file data "blob" size Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 55. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos 4 Tipos "commit" size tree cad6ae... Blobs parent 6f0104... author Someone <address> comitter Another <address> commit message Trees "tree" size 040000 tree 205f6b... somedir 100644 blob 9daeaf... somefile "tree" size 040000 blob 257cc5... other "blob" file data size "commit" size Commits "blob" size file data tree cad6ae... parent 6f0104... author Someone <address> comitter Another <address> commit message "tree" size 040000 tree 205f6b... somedir 100644 blob 9daeaf... somefile "tree" size "blob" size 040000 blob 257cc5... other file data "blob" size file data Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 56. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos 4 Tipos Blobs Trees Commits Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 57. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos 4 Tipos "commit" size "commit" size tree cad6ae... tree cad6ae... Blobs parent 6f0104... parent 6f0104... author Someone <address> author Someone <address> comitter Another <address> comitter Another <address> commit message commit message Trees "tree" size "tree" size 040000 tree 205f6b... somedir 040000 tree 205f6b... somedir 100644 blob 9daeaf... somefile 100644 blob 9daeaf... somefile "tree" size 040000 blob 257cc5... other "blob" file data size "tag" size "tree" size 040000 blob 257cc5... other "blob" file data size Commits "blob" size "blob" size file data file data object cad6ae... type commit tag tag−name Tags tagger Who <address> + date tag message Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 58. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos Imut´vel a type size data Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 59. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos Imut´vel a type size data type size data’ Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 60. Conceitos Estrutura Reposit´rio o Objetos Usando GIT Objetos Imut´vel a type size data type size data’ SHA1 8a9fd66b8bb939638564ebfdecc23b5d58070fc8 Marcello Henrique, faraohh@gmail.com Git o b´sico a 23 / 84
  • 61. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes Comandos Sintaxe ° git <options> <command> <options> Marcello Henrique, faraohh@gmail.com Git o b´sico a 24 / 84
  • 62. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes add fast-export merge-one-file revert am fast-import merge-resolve rm annotate fetch merge-subtree send-email apply fetch-pack merge-tree send-pack archimport filter-branch mergetool sh-setup archive fmt-merge-msg mktag shell bisect for-each-ref mktree shortlog blame format-patch mv show branch fsck name-rev show-branch bundle fsck-objects pack-objects show-index cat-file gc pack-redundant show-ref check-attr get-tar-commit-id pack-refs stash check-ref-format grep parse-remote status checkout gui patch-id stripspace checkout-index hash-object peek-remote submodule cherry http-fetch prune svn cherry-pick http-push prune-packed symbolic-ref citool imap-send pull tag clean index-pack push tar-tree clone init quiltimport unpack-file commit init-db read-tree unpack-objects commit-tree instaweb rebase update-index config log receive-pack update-ref count-objects lost-found reflog update-server-info cvsexportcommit ls-files relink upload-archive cvsimport ls-remote remote upload-pack cvsserver ls-tree repack var daemon mailinfo repo-config verify-pack describe mailsplit request-pull verify-tag diff merge rerere whatchanged diff-files merge-base reset write-tree diff-index merge-file rev-list diff-tree merge-index rev-parse gitk Marcello Henrique, faraohh@gmail.com Git o b´sico a 25 / 84
  • 63. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes add fast-export merge-one-file revert am fast-import merge-resolve rm annotate fetch merge-subtree send-email apply fetch-pack merge-tree send-pack archimport filter-branch mergetool sh-setup archive fmt-merge-msg mktag shell bisect for-each-ref mktree shortlog blame format-patch mv show branch fsck name-rev show-branch bundle fsck-objects pack-objects show-index cat-file gc pack-redundant show-ref check-attr get-tar-commit-id pack-refs stash check-ref-format grep parse-remote status checkout gui patch-id stripspace checkout-index hash-object peek-remote submodule cherry http-fetch prune svn cherry-pick http-push prune-packed symbolic-ref citool imap-send pull tag clean index-pack push tar-tree clone init quiltimport unpack-file commit init-db read-tree unpack-objects commit-tree instaweb rebase update-index config log receive-pack update-ref count-objects lost-found reflog update-server-info cvsexportcommit ls-files relink upload-archive cvsimport ls-remote remote upload-pack cvsserver ls-tree repack var daemon mailinfo repo-config verify-pack describe mailsplit request-pull verify-tag diff merge rerere whatchanged diff-files merge-base reset write-tree diff-index merge-file rev-list diff-tree merge-index rev-parse gitk Marcello Henrique, faraohh@gmail.com Git o b´sico a 26 / 84
  • 64. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes add fast-export merge-one-file revert am fast-import merge-resolve rm annotate fetch merge-subtree send-email apply fetch-pack merge-tree send-pack archimport filter-branch mergetool sh-setup archive fmt-merge-msg mktag shell bisect for-each-ref mktree shortlog blame format-patch mv show branch fsck name-rev show-branch bundle fsck-objects pack-objects show-index cat-file gc pack-redundant show-ref check-attr get-tar-commit-id pack-refs stash check-ref-format grep parse-remote status checkout gui patch-id stripspace checkout-index hash-object peek-remote submodule cherry http-fetch prune svn cherry-pick http-push prune-packed symbolic-ref citool imap-send pull tag clean index-pack push tar-tree clone init quiltimport unpack-file commit init-db read-tree unpack-objects commit-tree instaweb rebase update-index config log receive-pack update-ref count-objects lost-found reflog update-server-info cvsexportcommit ls-files relink upload-archive cvsimport ls-remote remote upload-pack cvsserver ls-tree repack var daemon mailinfo repo-config verify-pack describe mailsplit request-pull verify-tag diff merge rerere whatchanged diff-files merge-base reset write-tree diff-index merge-file rev-list diff-tree merge-index rev-parse gitk Marcello Henrique, faraohh@gmail.com Git o b´sico a 27 / 84
  • 65. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes add fast-export merge-one-file revert am fast-import merge-resolve rm annotate fetch merge-subtree send-email apply fetch-pack merge-tree send-pack archimport filter-branch mergetool sh-setup archive fmt-merge-msg mktag shell bisect for-each-ref mktree shortlog blame format-patch mv show branch fsck name-rev show-branch bundle fsck-objects pack-objects show-index cat-file gc pack-redundant show-ref check-attr get-tar-commit-id pack-refs stash check-ref-format grep parse-remote status checkout gui patch-id stripspace checkout-index hash-object peek-remote submodule cherry http-fetch prune svn cherry-pick http-push prune-packed symbolic-ref citool imap-send pull tag clean index-pack push tar-tree clone init quiltimport unpack-file commit init-db read-tree unpack-objects commit-tree instaweb rebase update-index config log receive-pack update-ref count-objects lost-found reflog update-server-info cvsexportcommit ls-files relink upload-archive cvsimport ls-remote remote upload-pack cvsserver ls-tree repack var daemon mailinfo repo-config verify-pack describe mailsplit request-pull verify-tag diff merge rerere whatchanged diff-files merge-base reset write-tree diff-index merge-file rev-list diff-tree merge-index rev-parse gitk Marcello Henrique, faraohh@gmail.com Git o b´sico a 28 / 84
  • 66. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes add fast-export merge-one-file revert am fast-import merge-resolve rm annotate fetch merge-subtree send-email apply fetch-pack merge-tree send-pack archimport filter-branch mergetool sh-setup archive fmt-merge-msg mktag shell bisect for-each-ref mktree shortlog blame format-patch mv show branch fsck name-rev show-branch bundle fsck-objects pack-objects show-index cat-file gc pack-redundant show-ref check-attr get-tar-commit-id pack-refs stash check-ref-format grep parse-remote status checkout gui patch-id stripspace checkout-index hash-object peek-remote submodule cherry http-fetch prune svn cherry-pick http-push prune-packed symbolic-ref citool imap-send pull tag clean index-pack push tar-tree clone init quiltimport unpack-file commit init-db read-tree unpack-objects commit-tree instaweb rebase update-index config log receive-pack update-ref count-objects lost-found reflog update-server-info cvsexportcommit ls-files relink upload-archive cvsimport ls-remote remote upload-pack cvsserver ls-tree repack var daemon mailinfo repo-config verify-pack describe mailsplit request-pull verify-tag diff merge rerere whatchanged diff-files merge-base reset write-tree diff-index merge-file rev-list diff-tree merge-index rev-parse gitk Marcello Henrique, faraohh@gmail.com Git o b´sico a 29 / 84
  • 67. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes Comandos de ajuda git help Lista dos comandos mais comuns git <command> -h breve ajuda man git-<command> git help <command> git <command> --help p´ginas de manual a Marcello Henrique, faraohh@gmail.com Git o b´sico a 30 / 84
  • 68. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes Configura¸˜o do usu´rio ca a °HOME/.gitconfig ° git config --global user.name "Seu nome" ° git config --global user.email usuario@dominio.com ° git config --global color.pager true ° git config --global color.ui auto Marcello Henrique, faraohh@gmail.com Git o b´sico a 31 / 84
  • 69. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes Configura¸˜o do usu´rio ca a °HOME/.gitconfig ° git config --global user.name "Seu nome" ° git config --global user.email usuario@dominio.com ° git config --global color.pager true ° git config --global color.ui auto Marcello Henrique, faraohh@gmail.com Git o b´sico a 31 / 84
  • 70. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes Configura¸˜o do usu´rio ca a ° cat .gitconfig [user] name = "Marcello Henrique" email = "faraohh@gmail.com" [core] pager = less -FRSX editor = vim [color] ui = auto [merge] tool = vimdiff Marcello Henrique, faraohh@gmail.com Git o b´sico a 32 / 84
  • 71. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes Comando de inicializa¸˜o ca ° git init cria a ´rea do projeto a cria o diret´rio .git o Marcello Henrique, faraohh@gmail.com Git o b´sico a 33 / 84
  • 72. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes O que commitar? adicionar ° git add file ° git add . remover ° git rm file renomear ° git mv old new Marcello Henrique, faraohh@gmail.com Git o b´sico a 34 / 84
  • 73. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes Ignorar arquivos ° cat .gitignore *.o *~ Marcello Henrique, faraohh@gmail.com Git o b´sico a 35 / 84
  • 74. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes Como commitar? ° git commit -a -m‘‘some comment’’ Vai criar um commit de tudo ou somente dos itens trabalhados (staged) Marcello Henrique, faraohh@gmail.com Git o b´sico a 36 / 84
  • 75. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes ° mkdir project HEAD ° cd project ° git init master index repository working tree .git Marcello Henrique, faraohh@gmail.com Git o b´sico a 37 / 84
  • 76. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes ° echo test > test HEAD master index repository working tree .git test Marcello Henrique, faraohh@gmail.com Git o b´sico a 37 / 84
  • 77. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes ° echo test > test HEAD ° git add test master index tree 52a266... blob 9daefb... "test" repository working tree .git test Marcello Henrique, faraohh@gmail.com Git o b´sico a 37 / 84
  • 78. Conceitos Comandos Reposit´rio o Branching Usando GIT Remotes ° echo test > test HEAD ° git add test master index ° git commit -m‘‘test’’ Created initial commit 6f01040: test commit 1 files changed, 1 insertions(+), 0 deletions(-) 6f0104... create mode 100644 test tree 52a266... blob 9daefb... "test" repository working tree .git test Marcello Henrique, faraohh@gmail.com Git o b´sico a 37 / 84