SlideShare une entreprise Scribd logo
1  sur  125
Télécharger pour lire hors ligne
Git
                          Sébastien Cevey <seb@cine7.net>
                                    http://bytes.inso.cc/

                          Purple Scout presentation (April 17, 2009)




Swiss Federal Institute                 XMMS2 Music Player             Playlouder MSP
of Technology, Lausanne
Outline

1. Introduction
2. Concepts & Local Workflow
3. Distributed Work
4. Advanced Features
5. Conclusion



                       2
1. Introduction



       3
Version Control Systems

• Record history
• Facilitate team work
• Expose source code
• Branch/merge development paths

                    4
Centralized VCS
                                        permissions
Master                                  branches
                           Repository

                                         commit

           checkout                             update


Copies       Working        Working            Working
              Copy           Copy               Copy


             Alice           Bob              Charlie
                       5
Distributed VCS
                                                                Repository
                               Repository
  Remote
(public/private)                                                         push
                                                Repository


                   clone
                                                                        pull

                     Working                 Working          Working
                      Copy                    Copy             Copy


  Local            Repository               Repository       Repository


                     Alice                    Bob            Charlie
                                    6
Centralized vs Distributed
•                            •
    synchronous                  asynchronous
    - unique reference           - copy = repository
    - fixed hierarchy             - loose hierarchy

•                            •
    centralized access           offline:
    control                      - history
                                 - commit
                                 - branches

•                            •
    simpler                      more powerful


                         7
Centralized vs Distributed
•                            •
    synchronous                  asynchronous
    - unique reference           - copy = repository
    - fixed hierarchy             - loose hierarchy

•                            •
    centralized access           offline:
    control                      - history
                                 - commit
                                 - branches

•                            •
    simpler                      more powerful

•                            •
    tråkig... ;_;                fun! ^_^
                         8
Git History
• Linus Torvalds needed a replacement for
  BitKeeper to maintain the Linux kernel
• Requirements:
   • Distributed              • Non-linear, custom workflows
   • Scalable & Fast          • Talk over HTTP, SSH, FTP, rsync,
                                  email, etc
   • Integrity guarantee
• First prototype on April 7, 2005
• Now used by many FOSS projects:
  Linux kernel, Freedesktop (X.org), Ruby on Rails, XMMS2,
  Android, Gnome, GCC, etc.
                              9
Why “Git” ?
git (plural gits)
      2. (British, slang, pejorative) A silly,
      incompetent, stupid, annoying or childish
      person.
          “Jacko is a git.”

Linus Torvalds:
   “I'm an egotistical bastard, and I name all my projects after
   myself. First Linux, now git.”



Alternatively: “Global Information Tracker”
                                  10
Git vs. other DVCS
    (Mercurial, Darcs, Bazaar, Monotone, etc)

+ Fast, scalable (execution and setup)
+ Powerful small tools (Unix spirit)
+ Lively development
+ Linus (smart design)




                       11
Git vs. other DVCS
    (Mercurial, Darcs, Bazaar, Monotone, etc)

+ Fast, scalable (execution and setup)
+ Powerful small tools (Unix spirit)
+ Lively development
+ Linus (smart design)
- Learning curve (grasp concepts)
- Imperfect on MS Windows
- Linus (no library)
                       12
Why Git is better than X?
 • Cheap Local Branching
 • Everything is Local
 • Git is Fast
 • Git is Small
 • The Staging Area
 • Distributed
 • Any Workflow
 • Easy to Learn
                         Source: http://whygitisbetterthanx.com/
                          13
2. Concepts
       &
Local Workflow


      14
Git Repository
                repository = object database




.git/objects/
                             15
Git Repository
                id(object) = SHA1(object content)



                 335e   a23f   6679


                                             601a   5592
                                                    34fe   cca6
                        3347   efa4
                               dd85   57bc
                                             cc39   3e93
                                                    2211   5390
                        8e9b   1798
                               332e   23a7
                                             1432   1260
                                                    93a4   cc5e
                        f943   eab4
                                                           b3ca
.git/objects/8e/9b...
                                       16
Git Repository
content is stored in blob objects
                 File

                                                  #include <stdio.h>

 335e   a23f   6679                               int main ()
                                                  {
                                                    printf(”Hello World”);
                             601a   5592
                                                    return 0;
                                                  }
                                    34fe   cca6
        3347   efa4
               dd85   57bc
                             cc39   3e93
                                    2211   5390
        8e9b   1798
                                                    git cat-file -p 93a4
               332e   23a7
                             1432   1260
                                    93a4   cc5e
        f943   eab4
                                           b3ca
                       17
Git Repository
structure is stored in tree objects
               Directory

                                                   040000 tree cc5e src
                                                   100644 blob 93a4 hw.c
  335e   a23f   6679


                              601a   5592
                                     34fe   cca6
         3347   efa4
                dd85   57bc
                              cc39   3e93
                                     2211   5390
         8e9b   1798
                                                     git cat-file -p 1260
                332e   23a7
                              1432   1260
                                     93a4   cc5e
         f943   eab4
                                            b3ca
                        18
Git Repository
                          history is stored in commit objects
                           Authenticated hierarchical snapshots

                                                                              tree 1260...
                                                                              parent f943...
                             335e   a23f   6679                               author Tom <tom@...>
                                                                                1204666883 +0100
                                                                              committer Max
                                                         601a   5592
                                                                                <max@...>
                                                                                1204666883 +0100
                                                                34fe   cca6
Note: identity is a                 3347   efa4
function of the whole                                                         Fixed a major bug in
                                           dd85   57bc
history!                                                                      Hello World.
                                                         cc39   3e93
i.e. build-in integrity
                                                                2211   5390
check                               8e9b   1798
                                                                                git cat-file -p 1432
                                           332e   23a7
                                                         1432   1260
                                                                93a4   cc5e
                                    f943   eab4
                                                                       b3ca
                                                   19
Git Repository
references are stored as tag objects
         (Signed) symbolic link

                                                    object a23f...
                                                    type commit
                                                    tag v1.0.7
   335e   a23f   6679                               tagger Jack <jack@...>
                                                      1136523576 -0800

                               601a   5592          GIT 1.0.7
                                                    -----BEGIN PGP
                                                    SIGNATURE-----
                                      34fe   cca6
          3347   efa4                               Version: GnuPG v1.4.2
                                                    (GNU/Linux)
                 dd85   57bc
                                                    iD8D…
                               cc39   3e93          -----END PGP
                                                    SIGNATURE-----
                                      2211   5390
          8e9b   1798
                 332e   23a7
                                                     git cat-file -p 335e
                               1432   1260
                                      93a4   cc5e
          f943   eab4
                                             b3ca
                         20
Git Repository
practical repository
entry points                                                    point to a
                                      branches




                                                    feature-X
                             master
                                                                commit in     git branch
   symbolic links                                               the graph




                      335e   a23f     6679


       tags                                         601a        5592
                                                                34fe   cca6
               v1.0          3347     efa4
                                      dd85   57bc
           alpha-3                                  cc39        3e93
                                                                2211   5390
      point to an            8e9b     1798
 object (usually a
                                      332e   23a7
         commit)                                    1432        1260
                                                                93a4   cc5e
                             f943     eab4
     git tag                                                           b3ca
                                              21
History Graph
                            branches




                                       feature-X
                   master
            HEAD   a23f


tags                                   601a

   v1.0            3347

  alpha-3                              cc39

                   8e9b

                                       1432

                   f943


                                 22
Git workflow
$ find
.
./src
./src/Makefile
./src/helloworld.c
./src/helloworld.h
./Makefile
./IDEAS
./README




IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h

                          23
initialize
$ git init
Initialized empty Git repository in /path/example/.git/




IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h

                                                          24
check status
$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use quot;git add <file>...quot; to include in what will be committed)
#
#      IDEAS
#      Makefile
#      README
#      src/
nothing added to commit but untracked files present (use quot;git
addquot; to track)



IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h

                                                       25
add files
$ git add .




IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h

                      26
check status
$ git status
#   On branch master
#
#   Initial commit
#
#   Changes to be committed:
#    (use quot;git rm --cached <file>...quot; to unstage)
#
#       new   file:   IDEAS
#       new   file:   Makefile
#       new   file:   README
#       new   file:   src/Makefile
#       new   file:   src/helloworld.c
#       new   file:   src/helloworld.h



IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h

                                                   27
commit
$ git commit -a -m quot;First importquot;
Created initial commit 04f087b: First import
0 files changed, 0 insertions(+), 0 deletions(-)




                                                        master
create mode 100644 IDEAS
create mode 100644 Makefile
create mode 100644 README
create mode 100644 src/Makefile
create mode 100644 src/helloworld.c
create mode 100644 src/helloworld.h




IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
                                                       04f087b
`-- helloworld.h

                                                  28
hack
$ echo quot;Blah blahquot; >> README




                                       master
$ rm IDEAS




Makefile
README             <- edited
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                      04f087b

                                29
check status
$ git status
# On branch master
# Changed but not updated:




                                                              master
# (use quot;git add/rm <file>...quot; to update what will be
committed)
#
#    deleted: IDEAS
#    modified: README
#
no changes added to commit (use quot;git addquot; and/or quot;git
commit -aquot;)




Makefile
README                    <- edited
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                             04f087b

                                                        30
commit
$ git commit -a -m quot;More stuffquot;
Created commit 54eda77: More stuff
1 files changed, 1 insertions(+), 0 deletions(-)




                                                        master
delete mode 100644 IDEAS




Makefile
README
                                                       54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                       04f087b

                                                  31
view commit
$ git show
commit 54eda77a85b0e5d1891653a36ff08faf133df030
Author: Sebastien Cevey <seb@cine7.net>




                                                   master
Date: Mon Apr 13 21:23:02 2009 +0200

  More stuff

diff --git a/IDEAS b/IDEAS
deleted file mode 100644
index e69de29..0000000
diff --git a/README b/README
index e69de29..579c5b1 100644
--- a/README
+++ b/README
@@ -0,0 +1 @@
+Blah blah
Makefile
README
                                                  54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                  04f087b

                                             32
view commit
$ git show --pretty=raw
commit 54eda77a85b0e5d1891653a36ff08faf133df030
tree 524f0cfe293064d18ac0c12a55baaf2b34d42e8d




                                                        master
parent 04f087b23ce96c2b24f9f6b5f7cf437af33e19c6
author Sebastien Cevey <seb@cine7.net> 1239650582
+0200
committer Sebastien Cevey <seb@cine7.net> 1239650582
+0200

   More stuff

[...]




Makefile
README
                                                       54eda77   524f0c
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                       04f087b

                                                 33
view history
$ git log
commit 54eda77a85b0e5d1891653a36ff08faf133df030
Author: Sebastien Cevey <seb@cine7.net>




                                                    master
Date: Mon Apr 13 21:23:02 2009 +0200

  More stuff

commit 04f087b23ce96c2b24f9f6b5f7cf437af33e19c6
Author: Sebastien Cevey <seb@cine7.net>
Date: Mon Apr 13 21:11:58 2009 +0200

  First import




Makefile
README
                                                   54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                   04f087b

                                              34
hack again
$ echo quot;/* End of fil */quot; >> src/helloworld.c




                                                master
Makefile
README
                                               54eda77
src
|-- Makefile
|-- helloworld.c        <- edited
`-- helloworld.h
                                               04f087b

                                          35
diff modifs
$ git diff
diff --git a/src/helloworld.c b/src/helloworld.c
index e69de29..54a606d 100644




                                                         master
--- a/src/helloworld.c
+++ b/src/helloworld.c
@@ -0,0 +1 @@
+/* End of fil */




Makefile
README
                                                        54eda77
src
|-- Makefile
|-- helloworld.c                 <- edited
`-- helloworld.h
                                                        04f087b

                                                   36
commit
$ git commit -a -m “Hasty commit”
Created commit 3b5ba16: Hasty commit
1 files changed, 1 insertions(+), 0 deletions(-)




                                                        master
                                                       3b5ba16

Makefile
README
                                                       54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                       04f087b

                                                  37
rewind history
$ git reset --hard HEAD^ # parent of HEAD
HEAD is now at 54eda77 More stuff




                                                    master
$ git status
# On branch master
nothing to commit (working directory clean)




Makefile
README
                                                   54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                   04f087b

                                              38
rewind history
$ git reset HEAD^ # parent of HEAD
src/helloworld.c: locally modified




                                                         master
$ git diff
diff --git a/src/helloworld.c b/src/helloworld.c
index e69de29..54a606d 100644
--- a/src/helloworld.c
+++ b/src/helloworld.c
@@ -0,0 +1 @@
+/* End of fil */




Makefile
README
                                                        54eda77
src
|-- Makefile
|-- helloworld.c                  <- edited
`-- helloworld.h
                                                        04f087b

                                                   39
new history
$ $EDITOR src/helloworld.c

$ git commit -a -m quot;Proper commitquot;




                                                        master
Created commit 0657c63: Proper commit
1 files changed, 1 insertions(+), 0 deletions(-)




                                                       0657c63

Makefile
README
                                                       54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                       04f087b

                                                  40
tag
$ git tag stable




                                   master
                         stable   0657c63

Makefile
README
                                  54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                  04f087b

                    41
new branch
$ git branch feature-X 54eda77




                                                         feature-X
                                                master
$ git branch
  feature-X
* master




                                      stable   0657c63

Makefile
README
                                               54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                               04f087b

                                 42
switch branch
$ git checkout feature-X
Switched to branch quot;feature-Xquot;




                                                         feature-X
                                                master
$ git branch
* feature-X
  master




                                      stable   0657c63

Makefile
README
                                               54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                               04f087b

                                 43
commit branch
$ $EDITOR src/helloworld.c




                                                                           feature-X
                                                                 master
$ git commit -a -m quot;Work on Xquot;
Created commit 6195849: Work on X
1 files changed, 1 insertions(+), 0 deletions(-)




                                                       stable   0657c63

                                                                          6195849
Makefile
README
                                                                54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                                04f087b

                                                  44
commit branch
$ $EDITOR README




                                                                           feature-X
                                                                 master
$ git commit -a -m quot;Edit README for Xquot;
Created commit 20fbfdd: Edit README for X
1 files changed, 1 insertions(+), 0 deletions(-)




                                                                          20fbfdd

                                                       stable   0657c63

                                                                          02bbf10
Makefile
README
                                                                54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                                04f087b

                                                  45
diff branches
$ git checkout master
Switched to branch quot;masterquot;




                                                             feature-X
                                                   master
$ git diff feature-X
diff --git a/README b/README
index 29a6a68..579c5b1 100644
--- a/README
+++ b/README
@@ -1,2 +1 @@
 Blah blah
-foo
[...]                                                       1e4cfe4

                                         stable   0657c63

                                                            02bbf10
Makefile
README
                                                  54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                  04f087b

                                    46
merge
$ git merge feature-X
Merge made by recursive.




                                                                           feature-X
README           | 1+




                                                                 master
src/helloworld.h | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)




                                                                69e105

                                                                          1e4cfe4

                                                       stable   0657c63

                                                                          02bbf10
Makefile
README
                                                                54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                                04f087b

                                                  47
view merge commit
$ git show
commit 69e105f3d1991c34d74d079197d5f1b1917d3120




                                                                      feature-X
Merge: 0657c63... 20fbfdd...




                                                            master
Author: Sebastien Cevey <seb@cine7.net>
Date: Mon Apr 13 22:49:16 2009 +0200

  Merge branch 'feature-X'




                                                           69e105

                                                                     1e4cfe4

                                                  stable   0657c63

                                                                     02bbf10
Makefile
README
                                                           54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                           04f087b

                                             48
undo
$ git reset --hard stable # undo last merge
HEAD is now at 0657c63 Proper commit




                                                                       feature-X
                                                             master
$ git checkout feature-X
Switched to branch quot;feature-Xquot;




                                                                      20fbfdd

                                                   stable   0657c63

                                                                      02bbf10
Makefile
README
                                                            54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                            04f087b

                                              49
rebase
$ git rebase master
First, rewinding head to replay your work on top of it...




                                                                                     feature-X
Applying: Work on X




                                                                           master
Applying: Edit README for X


$ git show-branch
* [feature-X] Edit README for X
 ! [master] Proper commit
                                                                                    aeaf0a
--
* [feature-X] Edit README for X
* [feature-X^] Work on X
*+ [master] Proper commit
                                                                                    2e309b
                                                                 stable   0657c63

Makefile
README
                                                                          54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                                          04f087b

                                                            50
trivial merge
$ git checkout master
Switched to branch quot;masterquot;




                                                                            feature-X
                                                                  master
$ git merge feature-X
Updating 0657c63..aeaf0a9
Fast forward
 README           | 1+
 src/helloworld.h | 1 +
                                                                           aeaf0a
 2 files changed, 2 insertions(+), 0 deletions(-)




                                                                           2e309b
                                                        stable   0657c63

Makefile
README
                                                                 54eda77
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
                                                                 04f087b

                                                   51
git show-branch




       52
gitk




 53
gitk




 54
3. Distributed Work



         55
public repository




                              t
                             aul
                    r
                 ste



                             f
                         seg
             ma


                        fix-
             D

             C           E

             B

                              public repo
             A




        56
clone




                                                                      t
                                                                     aul
                                                            r
                                                         ste



                                                                     f
                                                                 seg
                                                     ma


                                                                fix-
(over local filesystem, ssh://, git://,
        rsync://, ftp://etc)
                                                     D

                                                     C           E

                                                     B




                                    lt
                                   fau
                        r
                       ste

                                                                      public repo
                                                     A
                                 seg
                   ma


                              fix-


                                            $ git clone $URL
                                            Initialized empty Git repository in local/
                                            copy/.git/
                   D

                   C           E

                   B

                             local repo
                   A

                                       57
branch namespace




                                                               t
                                                              aul
                                                     r
                                                  ste



                                                              f
                                                          seg
                                              ma


                                                         fix-
                                              D

                                              C           E
         origin/
                                              B




                              lt
                             fau
 r




                  r
ste




                 ste

                                                               public repo
                                              A
                           seg
ma




             ma


                        fix-


                                      $ git branch --all
                                      *master
                                       origin/HEAD
             D
                                       origin/fix-segfault
             C           E
                                       origin/master
             B

                       local repo
             A

                                 58
public repository updated




                                                      t
                                                     aul
                                            r
                                         ste



                                                     f
                                                 seg
                                     ma


                                                fix-
                                     D           F

                                     C           E
        origin/
                                     B




                             lt
                            fau
 r




                 r
ste




                ste

                                                      public repo
                                     A
                          seg
ma




            ma


                       fix-




            D

            C           E

            B

                      local repo
            A

                                59
fetch update




                                                             t
                                                            aul
                                                   r
                                                ste



                                                            f
                                                        seg
                                            ma


                                                       fix-
                                            D           F

                                            C           E
       origin/
                                            B




                            lt
                           fau
 r




                r
ste




               ste

                                                             public repo
                                            A
                         seg
ma




           ma


                      fix-


                                    $ git fetch origin
                                    remote: Counting objects: 5, done.
                                    remote: Compressing objects: 100% (2/2), done.
           D           F
                                    remote: Total 3 (delta 0), reused 0 (delta 0)
           C           E
                                    Unpacking objects: 100% (3/3), done.
                                    From /public/repo
           B
                                     E..F fix-segfault -> origin/fix-segfault
                     local repo
           A

                               60
checkout tracking branch




                                                                             t
                                                                            aul
                                                                   r
                                                                ste



                                                                            f
                                                                        seg
                                                            ma


                                                                       fix-
      “topic branch”     “tracking branches”                D           F

                                                            C           E
                       origin/
                                                            B




                                            lt
                                           fau
 r




                                r
         rk
ste




                               ste

                                                                             public repo
                                                            A
                                         seg
      wo
ma




                           ma


                                      fix-


                                                    $ git checkout -b work 
                                                      origin/fix-segfault
                           D           F
                                                    Branch work set up to track remote branch
                                                    refs/remotes/origin/fix-segfault.
                           C           E
                                                    Switched to a new branch quot;workquot;
                           B

                                     local repo
                           A

                                               61
commit topic branch




                                                                        t
                                                                       aul
                                                              r
                                                           ste



                                                                       f
                                                                   seg
                                                       ma


                                                                  fix-
                                                       D           F
                  origin/
                                                       C           E




                                       lt
                                      fau
 r




                           r
         rk
ste




                          ste

                                                                        public repo
                                                       B
                                    seg
      wo
ma




                      ma


                                 fix-


                                               $ $EDITOR
                                               $ git commit -a -m quot;Another fixquot;
              G

                                               [...]
                      D           F

                      C           E

                                local repo
                      B

                                          62
push new commit




                                                                        t
                                                                       aul
                                                              r
                                                           ste



                                                                       f
                                                                   seg
                                                       ma


                                                                  fix-
                                                                  G

                                                      D            F
                 origin/
                                                       C           E




                                      lt
                                     fau
 r




                          r
         rk
ste




                         ste

                                                                        public repo
                                                       B
                                   seg
      wo
ma




                     ma


                                fix-


                                              $ git push origin work:fix-segfault
                                              Total 0 (delta 0), reused 0 (delta 0)
                                 G            To /public/repo
                                                F..G work -> feature-X
                     D           F

                     C           E

                               local repo
                     B

                                         63
public repository updated




                                                            t
                                                           aul
                                                  r
                                               ste



                                                           f
                                                       seg
                                           ma


                                                      fix-
                                                      H

                                                      G
              origin/
                                           D           F




                                   lt
                                  fau
 r




                       r
         rk
ste




                      ste

                                                            public repo
                                           C           E
                                seg
      wo
ma




                  ma


                             fix-




                              G

                  D           F

                  C           E

                            local repo
                  B

                                      64
fetch update




                                                                     t
                                                                    aul
                                                           r
                                                        ste



                                                                    f
                                                                seg
                                                     ma


                                                               fix-
                                                               H

                                                               G
               origin/
                                                    D           F




                                    lt
                                   fau
 r




                        r
         rk
ste




                       ste

                                                                     public repo
                                                    C           E
                                 seg
      wo
ma




                   ma


                              fix-


                                            $ git fetch origin
                                            [...]
                               H
                                            From /public/repo
                                             G..H fix-segfault -> origin/fix-segfault
                               G

                   D           F

                             local repo
                   C

                                       65
pull to merge update




                                                                    t
                                                                   aul
                                                          r
                                                       ste



                                                                   f
                                                               seg
                                                   ma


                                                              fix-
                                                              H

                                                              G
              origin/
                                                   D           F




                                   lt
                                  fau
 r




                       r
         rk
ste




                      ste

                                                                    public repo
                                                   C           E
                                seg
      wo
ma




                  ma


                             fix-


                                           $ git pull origin
                                           Updating G..H
                              H
                                           Fast forward
                                            README | 1 +
                              G
                                            1 files changed, 1 insertions(+), 0
                                           deletions(-)
                  D           F

                            local repo
                  C

                                      66
Basic multi-repo commands
• git clone: init a copy of a repository
• git fetch: sync remote repo R with
              local branches R/*
• git pull: fetch + merge

• git push <repo> [<local-branch>:<remote-branch>]

                            67
ma
                        ste
                              r

                    wo
                       rk

                  pre
                     -m
                        e   rge



                                                            ma
                                                                   ste




                                       dev/
                                                                      r
                   ma
                        ste
                              r                                  tes
                                                                    t
                                                           bug
                                                                 gy-
                                                                     cra
                                                 dev




                                                                        p




68
                                                            ma
                                                                   ste
                                                                      r
                                                          exp
                                                             eri
                                                                   me
                                                                     nta
                                                                                 l
                                                           fix-
                                                                 seg
                                                                     f   aul
                                                 anna




                                                                             t
                                                                                     Real-life layout




                                       stable/




                   ma
                        ste
                              r
                                                            ma
                                                                   ste
                                                                      r
                  fix-
                     seg
                           fau
                                  lt
                                                           fix-
                                                              seg
                                                                  f
     local repo




                                                                       aul
                                                                           t
                                                 stable
ma
                        ste
                              r

                    wo
                       rk

                  pre
                     -m
                        e   rge



                                                                                       ma
                                                                                              ste




                                       dev/
                                                                                                 r
                   ma
                        ste
                              r                                                             tes
                                                                                               t
                                                                                      bug
                                                                                            gy-
                                                                                                cra
                                                                            dev




                                                                                                   p
                                                 git remote add anna $URL




                                       anna/




69
                                                                                       ma
                                                                                              ste
                                                                                                 r
                                                                                     exp
                                                                                        eri
                                                                                              me
                                                                                                nta
                                                                                                            l
                                                                                      fix-
                                                                                            seg
                                                                                                f   aul
                                                                            anna




                                                                                                        t
                                                                                                                Real-life layout




                                       stable/




                   ma
                        ste
                              r
                                                                                       ma
                                                                                              ste
                                                                                                 r
                  fix-
                     seg
                           fau
                                  lt
                                                                                      fix-
                                                                                         seg
                                                                                             f
     local repo




                                                                                                  aul
                                                                                                      t
                                                                            stable
ma
                           ste
                                 r

                        wo
                           rk

                   pre
                        -m
                           e   rge



                                                                                 ma
                                                                                        ste




                                           dev/
                                                                                           r
                    ma
                         ste
                               r                                                      tes
                                                                                         t
                                                                                bug
                                                                                      gy-
                                                                                          cra
                                                                      dev




                                                                                             p

                                           anna/




70
                     ma
                                                     git fetch anna



                           ste
                                 r
                  exp
                     eri                                                         ma
                         me                                                             ste
                            nt                                                             r
                                      al
                  fix-                                                          exp
                     seg                                                          eri
                            fau
                                     lt                                                 me
                                                                                          nta
                                                                                                      l
                                                                                fix-
                                                                                      seg
                                                                                          f   aul
                                                                      anna




                                                                                                  t
                                                                                                          Real-life layout




                                           stable/




                    ma
                         ste
                               r
                                                                                 ma
                                                                                        ste
                                                                                           r
                  fix-
                     seg
                            fau
                                     lt
                                                                                fix-
                                                                                   seg
                                                                                       f
     local repo




                                                                                            aul
                                                                                                t
                                                                      stable
ma
                           ste
                                 r
                                                                                                    not in .git/”
                                                                                                    “just a repo,


                        wo
                                                                             git --bare init
                           rk

                   pre
                        -m

                                                     mine
                           e   rge



                                                                ma
                                                                       ste




                                           dev/
                                                                          r
                    ma
                         ste
                               r                                     tes
                                                                        t
                                                               bug
                                                                     gy-
                                                                         cra
                                                     dev




                                                                            p

                                           anna/




71
                     ma
                           ste
                                 r
                  exp
                     eri                                        ma
                         me                                            ste
                            nt                                            r
                                      al
                  fix-                                         exp
                     seg                                         eri
                            fau
                                     lt                                me
                                                                         nta
                                                                                               l
                                                               fix-
                                                                     seg
                                                                         f   aul
                                                     anna




                                                                                     t
                                                                                                   Real-life layout




                                           stable/




                    ma
                         ste
                               r
                                                                ma
                                                                       ste
                                                                          r
                  fix-
                     seg
                            fau
                                     lt
                                                               fix-
                                                                  seg
                                                                      f
     local repo




                                                                           aul
                                                                                     t
                                                     stable
ma
                           ste
                                 r

                        wo
                           rk

                   pre
                        -m

                                                                                mine
                           e   rge



                                                                                           ma
                                                                                                  ste




                                           dev/
                                                                                                     r
                    ma
                         ste
                               r                                                                tes
                                                                                                   t
                                                     git remote add mine $URL

                                                                                          bug
                                                                                                gy-
                                                                                                    cra
                                                                                dev




                                                                                                       p

                                           anna/




72
                     ma
                           ste
                                 r
                  exp
                     eri                                                                   ma
                         me                                                                       ste
                            nt                                                                       r
                                      al
                  fix-                                                                    exp
                     seg                                                                    eri
                            fau
                                     lt                                                           me
                                                                                                    nta
                                                                                                                l
                                                                                          fix-
                                                                                                seg
                                                                                                    f   aul
                                                                                anna




                                                                                                            t
                                                                                                                    Real-life layout




                                           stable/




                    ma
                         ste
                               r
                                                                                           ma
                                                                                                  ste
                                                                                                     r
                  fix-
                     seg
                            fau
                                     lt
                                                                                          fix-
                                                                                             seg
                                                                                                 f
     local repo




                                                                                                      aul
                                                                                                          t
                                                                                stable
ma
                           ste
                                 r
                                                                                                         ma
                                                                                                                ste
                                                                                                                   r
                        wo
                           rk
                                                                                                       pre
                                                                                                           -m
                                                                                                                 erg
                                                                                                                     e
                   pre
                        -m

                                                                                              mine
                           e   rge



                                                                                                         ma




                                           mine/
                                                                                                                ste
                    ma                                                                                             r
                         ste
                               r
                                                                                                              tes
                                                                                                                 t
                  pre
                        -m
                           e   rge                                                                      bug
                                                                                                              gy-
                                                                                                                  cra
                                                                                              dev




                                                                                                                     p




73
                                           dev/
                                                                                                         ma
                    ma                                                                                          ste
                                                                                                                   r
                         ste
                               r
                                                                                                       exp
                                                                                                          eri
                                                                                                                me
                                                        git push mine work:master pre-merge




                                                                                                                  nta
                                                                                                                               l
                                                                                                        fix-
                                           anna/




                                                                                                              seg
                                                                                                                  f
                     ma                                                                                               aul
                                                                                              anna




                                                                                                                           t
                                                                                                                                   Real-life layout




                           ste
                                 r
                  exp
                     eri
                         me
                            nt        al
                                                                                                         ma
                  fix-                                                                                           ste
                                                     “remotes”




                                                                                                                   r
                     seg
                            fau
                                     lt
                                                                                                        fix-
                                                                                                             seg
                                                                                                                 f   aul
                                                                                                                        t
                                                                                              stable




                                           stable/




     local repo




                    ma
                         ste
                               r
git remote

• Help track remote (i.e. other) repositories
• Pull from / push to them
• Use tracking branches like any branch (merge, rebase,
  diff, log, show, etc)




                           74
e.g. XMMS2 trees
Official trees             stable              devel




Developer                                                        public
                          public
public trees                                                    theefer
                           tru




Local trees     Joe Sixpack        tru                anders    theefer

                   user                  maintainers           developer
                                   75
e.g. XMMS2 trees
                          stable              devel


olof’s server

   public
                                                                 public
    olof                  public                                theefer
                           tru




     olof       Joe Sixpack        tru                anders    theefer

 contributer       user                  maintainers           developer
                                   76
4. Advanced Features



         77
Between the working
directory and the repository
                        Repository
  Working




                            master
  Directory
IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h



                           04f087b
                   78
The Index (or “Staging Area”)
                             Index
                   IDEAS
                   Makefile
                                      Repository
                   README
  Working          src
                   |-- Makefile




                                            master
  Directory        |-- helloworld.c
                   `-- helloworld.h

IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h



                                           04f087b
                            79
Committing using the index
                                 Index
                   IDEAS
                   Makefile
                                                      Repository
                   README
  Working          src
                   |-- Makefile




                                                          master
  Directory        |-- helloworld.c
                   `-- helloworld.h

IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h


                    git add/rm           git commit
                                                         04f087b
                                 80
Bypassing the Index
                             Index
                   IDEAS
                   Makefile
                                                      Repository
                   README
  Working          src
                   |-- Makefile




                                                          master
  Directory        |-- helloworld.c
                   `-- helloworld.h

IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h



                                                         04f087b
                                      git commit -a
                            81
new file
                               Index
                     IDEAS
                     Makefile
                                        Repository
                     README
  Working            src
                     |-- Makefile




                                            master
  Directory          |-- helloworld.c
                     `-- helloworld.h

IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
test.c <- new file
TODO   <- new file

                                           04f087b
                              82
$ git status


                     new file
                                        # On branch master
                                        # Changed but not updated:
                                        # (use quot;git add <file>...quot; to update
                                        what will be committed)
                                        #
                                        #      modified: test.c
                                        #      modified: TODO
                               Index    #
                                        no changes added to commit (use
                                        quot;git addquot; and/or quot;git commit -aquot;)
                     IDEAS
                     Makefile
                                                   Repository
                     README
  Working            src
                     |-- Makefile




                                                            master
  Directory          |-- helloworld.c
                     `-- helloworld.h

IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
test.c <- new file
TODO   <- new file

                                                          04f087b
                              83
new file: add to index
                                Index
                     IDEAS
                     Makefile
                                          Repository
                     README
  Working            src
                     |-- Makefile




                                              master
  Directory          |-- helloworld.c
                     `-- helloworld.h
                     TODO   <- new file
IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
test.c <- new file
TODO
                     git add TODO
                                             04f087b
                               84
new file: add to index
                                          $ git status
                                          #   On branch master
                                          #   Changes to be committed:
                                Index     #    (use quot;git reset HEAD <file>...quot; to unstage)
                                          #
                                          #       modified: TODO
                     IDEAS
                                          #
                     Makefile
                                                                Repository
                     README               #   Changed but not updated: [...]

  Working            src
                     |-- Makefile




                                                                         master
  Directory          |-- helloworld.c
                     `-- helloworld.h
                     TODO   <- new file
IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h
test.c <- new file
TODO
                     git add TODO
                                                                       04f087b
                               85
new file: commit index
                               Index
                     IDEAS
                     Makefile
                                                     Repository
                     README
  Working            src
                     |-- Makefile




                                                          master
  Directory          |-- helloworld.c
                     `-- helloworld.h
                     TODO
IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                                        deadbeef
test.c <- new file
TODO
                                        git commit
                                                        04f087b
                              86
edited file
                                Index
                      IDEAS
                      Makefile
                                         Repository
                      README
  Working             src
                      |-- Makefile




                                              master
  Directory           |-- helloworld.c
                      `-- helloworld.h
                      TODO
IDEAS
Makefile
README <- edited
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                            deadbeef
test.c <- new file
TODO

                                            04f087b
                               87
edited file: update index
                                 Index
                      IDEAS
                      Makefile
                                           Repository
                      README   <- edited
  Working             src
                      |-- Makefile




                                                master
  Directory           |-- helloworld.c
                      `-- helloworld.h
                      TODO
IDEAS
Makefile
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                              deadbeef
test.c <- new file
TODO
                     git add README
                                              04f087b
                                88
edited file: commit index
                               Index
                     IDEAS
                     Makefile
                                                     Repository
                     README
  Working            src
                     |-- Makefile




                                                          master
  Directory          |-- helloworld.c
                     `-- helloworld.h
                     TODO
IDEAS
Makefile
                                                         f4ec56
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                                        deadbeef
test.c <- new file
TODO
                                        git commit
                                                        04f087b
                              89
edited file
                                 Index
                       IDEAS
                       Makefile
                                          Repository
                       README
  Working              src
                       |-- Makefile




                                               master
  Directory            |-- helloworld.c
                       `-- helloworld.h
                       TODO
IDEAS    <- 3 hunks
Makefile
                                              f4ec56
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                             deadbeef
test.c <- new file
TODO

                                             04f087b
                                90
add selected hunks to index
                                    Index
                       IDEAS    <- 1 hunk
                       Makefile
                                                                        Repository
                       README
  Working              src
                       |-- Makefile




                                                                             master
  Directory            |-- helloworld.c
                       `-- helloworld.h
                       TODO
IDEAS    <- 2 hunks
Makefile
                                                                            f4ec56
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                                                           deadbeef
                                     (also see git add --interactive)
test.c <- new file
TODO
                      git add -p IDEAS
                                                                           04f087b
                                   91
add selected hunks to index
                                                   Index
    $ git add -p src/xmms/testclient.c
    [...]
    @@ -44,7 +44,7 @@ int main (int argc, char **argv) 1 hunk
                                      IDEAS        <-
                                     Makefile
                                                                                       Repository
     	   fd = xmms_ipc_transport_fd_get (transport);
                                     README
   Working                           src
                                     |-- Makefile
   -	    msg = xmms_ipc_msg_string_new (42, quot;korv!quot;);




                                                                                            master
   Directory                         |-- helloworld.c
   +	    msg = xmms_ipc_msg_string_new (42, quot;apan!quot;);
                                     `-- helloworld.h
                                     TODO
     	   i = 5;
IDEAS     <- 2 hunks
Makefilethis hunk [y/n/a/d/j/J/?]?
    Stage
                                                                                           f4ec56
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                                                                          deadbeef
                                                    (also see git add --interactive)
test.c <- new file
TODO
                                     git add -p IDEAS
                                                                                          04f087b
                                                  92
diff’ing options
                                           Index
                                 IDEAS    <- 1 hunk
                                 Makefile
                                                                         Repository
                                 README
  Working                        src
                                 |-- Makefile




                                                                                master
  Directory                      |-- helloworld.c
                                                          git diff --cached
                                 `-- helloworld.h
                                 TODO
IDEAS    <- 2 hunks
Makefile
                                                                               f4ec56
README
src                   git diff
|-- Makefile
|-- helloworld.c
`-- helloworld.h                                                              deadbeef
test.c <- new file
TODO
                                                 git diff HEAD
                                                                              04f087b
                                          93
Conflicts: marked in index
                               Index
                     IDEAS    <- conflicted
                     Makefile
                                              Repository
                     README
  Working            src
                     |-- Makefile




                                                   master
  Directory          |-- helloworld.c
                     `-- helloworld.h
                     TODO
IDEAS    <- merged
Makefile
                                                  f4ec56
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                                 deadbeef
TODO


                                                 04f087b
                              94
Reset changes: 3 options
                             Index
                   IDEAS
                   Makefile
                                      Repository
                   README
  Working          src
                   |-- Makefile




                                           master
  Directory        |-- helloworld.c
                   `-- helloworld.h
                   TODO
IDEAS
Makefile
                                          f4ec56
README
src
|-- Makefile
|-- helloworld.c
`-- helloworld.h                         deadbeef
TODO


                                         04f087b
                            95
reset --hard
  reset the repository
  HEAD, the index
                                       Index
  and the working         deadbeef
  directory.               IDEAS
                           Makefile
                                                                       Repository
                           README
     Working               src
                           |-- Makefile




                                                                            master
     Directory             |-- helloworld.c
                           `-- helloworld.h
deadbeef                   TODO
 IDEAS
 Makefile
                                                                           f4ec56
 README
 src
 |-- Makefile
 |-- helloworld.c
 `-- helloworld.h                    git reset --hard deadbeef            deadbeef
 TODO

                                            Warning: any uncommitted
                                                                          04f087b
                                            change is lost!
                                       96
reset --soft
 only reset the
 repository HEAD.
                                    Index
                       f4ec56
                        IDEAS
                        Makefile
                                                                    Repository
                        README
     Working            src
                        |-- Makefile




                                                                         master
     Directory          |-- helloworld.c
                        `-- helloworld.h
f4ec56                  TODO
 IDEAS
 Makefile
                                                                        f4ec56
 README
 src
 |-- Makefile
 |-- helloworld.c
 `-- helloworld.h                                                      deadbeef
                                        git reset --soft deadbeef
 TODO

                    Previous commit becomes
                                                                       04f087b
                    “changes to be committed”.
                                   97
reset --mixed (default)
 reset the repository
 HEAD and the
                                        Index
 index, but not the        deadbeef
 working directory.         IDEAS
                            Makefile
                                                                     Repository
                            README
     Working                src
                            |-- Makefile




                                                                          master
     Directory              |-- helloworld.c
                            `-- helloworld.h
f4ec56                      TODO
 IDEAS
 Makefile
                                                                         f4ec56
 README
 src
 |-- Makefile
 |-- helloworld.c
 `-- helloworld.h                                                       deadbeef
                                        git reset --mixed deadbeef
 TODO

                        Keep changes but not
                                                                        04f087b
                        marked for commit.
                                       98
Using the Index (or not)
• “Invisible” area to prepare commits
• Interact with:
  - working directory (add, rm)
  - repository (reset, commit)
• Analyze state (status, diff)
• Can usually be bypassed (using -a)
• Warning:
  - Can commit files in inconsistent state
    (e.g. not tested)

                         99
Git layers




  Source: http://osteele.com/archives/2008/05/commit-policies
         100
Rewrite history!
• Changing the history = point to a new history
• Correct mistakes
• Cleanup messy iterative development
• Warning:
  - Changes commit ids
  - (Possibly) creates conflicts if when people
  merge the rewritten branch
  - Best used locally, not on an important tree

                         101
Rewrite history! (1)
• git commit --amend




                                                 r
                                              ste
                                          ma
• “Replace the latest commit by
    the current state of the index”   K
                                          D



•   Allows to keep or edit the            C



    commit message
                                          B

                                          A




                          102
Rewrite history! (1)
• git commit --amend




                                             r
                                          ste
                                      ma
• “Replace the latest commit by
    the current state of the index”   D          K



•   Allows to keep or edit the        C



    commit message
                                      B

                                      A




                          103
Rewrite history! (2)
• git rebase --interactive




                                          r
                                       ste
                                   ma
• Rewrite a sequence of commits:
  - omit
                                   F
  - squash with parent             E
  - edit                           D

                                   C

                                   B

                                   A




                         104
Rewrite history! (2)
• git rebase --interactive




                                          r
                                       ste
                                   ma
• Rewrite a sequence of commits:
  - omit
                                   F          T (E+F)
  - squash with parent             E
  - edit                           D           S (D)

                                   C

                                   B            B

                                   A




                         105
Rewrite history! (3)
• git filter-branch
• Rewrite history using functions/scripts
• Edit author infos, commit message,
  directories, commits, tags, etc.


• RTFM...


                          106
git bisect
• Useful to find the commit that
  introduces a problem




                                           r
                                        ste
                                    ma
• git bisect start <bad> [<good>]              HEAD
                                    H

                                    D

                                    C

                                    B

                                    A




                         107
git bisect
• Useful to find the commit that
  introduces a problem




                                           r
                                        ste
                                    ma
• git bisect start <bad> [<good>]   H


• git bisect bag|good               D

                                    C

                                    B


                                               HEAD
                                    A




                         108
git bisect
• Useful to find the commit that
  introduces a problem




                                           r
                                        ste
                                    ma
• git bisect start <bad> [<good>]   H


• git bisect bag|good               D


                                               HEAD
                                    C

                                    B

                                    A




                         109
git bisect
• Useful to find the commit that
  introduces a problem




                                           r
                                        ste
                                    ma
• git bisect start <bad> [<good>]   H


• git bisect bag|good                          HEAD
                                    D

                                    C

                                    B

                                    A




                         110
git blame
• git blame D <file>




                                   r
                                ste
                            ma
                            H


                                       HEAD
                            D

                            C

                            B

                            A




                      111
git stash
• git stash [save [message]]




                                          r
                                       ste
• git stash apply




                                       ma
• git stash pop # apply and drop
                              modifs




• Can also preserve the state of
  the index


                        112
git stash
• git stash [save [message]]




                                               {0}
                                      r
                                   ste


                                               sh@
• git stash apply




                                   ma


                                           sta
• git stash pop # apply and drop
                                          modifs




• Can also preserve the state of
  the index


                        113
git stash
• git stash [save [message]]




                                               {0}
                                      r
                                   ste


                                               sh@
• git stash apply




                                   ma


                                           sta
• git stash pop # apply and drop
                                          modifs




• Can also preserve the state of
  the index


                        114
git stash
• git stash [save [message]]




                                                   {0}
                                          r
                                       ste


                                                   sh@
• git stash apply




                                       ma


                                               sta
• git stash pop # apply and drop
                              modifs
                                              modifs




• Can also preserve the state of
  the index


                        115
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö
Git Presentation - Purple Scout AB Malmö

Contenu connexe

En vedette

Jez jowett social, digital, pr, experiential and content predictions 2012
Jez jowett social, digital, pr, experiential and content predictions 2012Jez jowett social, digital, pr, experiential and content predictions 2012
Jez jowett social, digital, pr, experiential and content predictions 2012Jez Jowett
 
Fanographie keynote jez jowett 270312
Fanographie keynote jez jowett 270312Fanographie keynote jez jowett 270312
Fanographie keynote jez jowett 270312Jez Jowett
 
How festivals and events have changed with social media
How festivals and events have changed with social mediaHow festivals and events have changed with social media
How festivals and events have changed with social mediaJez Jowett
 
Social media and sailing 2010
Social media and sailing 2010Social media and sailing 2010
Social media and sailing 2010Jez Jowett
 
Jez jowett social media tips 2011
Jez jowett social media tips 2011Jez jowett social media tips 2011
Jez jowett social media tips 2011Jez Jowett
 
Havas Sports and Entertainment 2016
Havas Sports and Entertainment 2016Havas Sports and Entertainment 2016
Havas Sports and Entertainment 2016Jez Jowett
 
How to do Social Media May 2011
How to do Social Media May 2011How to do Social Media May 2011
How to do Social Media May 2011Jez Jowett
 
Sponsorship trends for 2014 (marketing, branding, naming, rights, events, dig...
Sponsorship trends for 2014 (marketing, branding, naming, rights, events, dig...Sponsorship trends for 2014 (marketing, branding, naming, rights, events, dig...
Sponsorship trends for 2014 (marketing, branding, naming, rights, events, dig...Jez Jowett
 

En vedette (8)

Jez jowett social, digital, pr, experiential and content predictions 2012
Jez jowett social, digital, pr, experiential and content predictions 2012Jez jowett social, digital, pr, experiential and content predictions 2012
Jez jowett social, digital, pr, experiential and content predictions 2012
 
Fanographie keynote jez jowett 270312
Fanographie keynote jez jowett 270312Fanographie keynote jez jowett 270312
Fanographie keynote jez jowett 270312
 
How festivals and events have changed with social media
How festivals and events have changed with social mediaHow festivals and events have changed with social media
How festivals and events have changed with social media
 
Social media and sailing 2010
Social media and sailing 2010Social media and sailing 2010
Social media and sailing 2010
 
Jez jowett social media tips 2011
Jez jowett social media tips 2011Jez jowett social media tips 2011
Jez jowett social media tips 2011
 
Havas Sports and Entertainment 2016
Havas Sports and Entertainment 2016Havas Sports and Entertainment 2016
Havas Sports and Entertainment 2016
 
How to do Social Media May 2011
How to do Social Media May 2011How to do Social Media May 2011
How to do Social Media May 2011
 
Sponsorship trends for 2014 (marketing, branding, naming, rights, events, dig...
Sponsorship trends for 2014 (marketing, branding, naming, rights, events, dig...Sponsorship trends for 2014 (marketing, branding, naming, rights, events, dig...
Sponsorship trends for 2014 (marketing, branding, naming, rights, events, dig...
 

Similaire à Git Presentation - Purple Scout AB Malmö

Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )Tim Bunce
 
Starting up Containers Super Fast With Lazy Pulling of Images
Starting up Containers Super Fast With Lazy Pulling of ImagesStarting up Containers Super Fast With Lazy Pulling of Images
Starting up Containers Super Fast With Lazy Pulling of ImagesKohei Tokunaga
 
MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011Mats Kindahl
 
Gitting It Under (Version) Control
Gitting It Under (Version) ControlGitting It Under (Version) Control
Gitting It Under (Version) Controlmobiledevnj
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git RightSven Peters
 
[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory AnalysisMoabi.com
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory AnalysisMoabi.com
 
Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15Chen-Han Hsiao
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...Maarten Balliauw
 
Platform Clouds, Containers, Immutable Infrastructure Oh My!
Platform Clouds, Containers, Immutable Infrastructure Oh My!Platform Clouds, Containers, Immutable Infrastructure Oh My!
Platform Clouds, Containers, Immutable Infrastructure Oh My!Stuart Charlton
 
Confraria SECURITY & IT - Lisbon Set 29, 2011
Confraria SECURITY & IT - Lisbon Set 29, 2011Confraria SECURITY & IT - Lisbon Set 29, 2011
Confraria SECURITY & IT - Lisbon Set 29, 2011ricardomcm
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETMaarten Balliauw
 
[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit AutomationMoabi.com
 
An introduction to git
An introduction to gitAn introduction to git
An introduction to gitolberger
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory AnalysisMoabi.com
 
Scale11x lxc talk
Scale11x lxc talkScale11x lxc talk
Scale11x lxc talkdotCloud
 

Similaire à Git Presentation - Purple Scout AB Malmö (20)

Git Going with DVCS v1.6.0
Git Going with DVCS v1.6.0Git Going with DVCS v1.6.0
Git Going with DVCS v1.6.0
 
Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )Perl Memory Use 201207 (OUTDATED, see 201209 )
Perl Memory Use 201207 (OUTDATED, see 201209 )
 
Racing with Droids
Racing with DroidsRacing with Droids
Racing with Droids
 
Starting up Containers Super Fast With Lazy Pulling of Images
Starting up Containers Super Fast With Lazy Pulling of ImagesStarting up Containers Super Fast With Lazy Pulling of Images
Starting up Containers Super Fast With Lazy Pulling of Images
 
MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011MySQL Binary Log API Presentation - OSCON 2011
MySQL Binary Log API Presentation - OSCON 2011
 
Gitting It Under (Version) Control
Gitting It Under (Version) ControlGitting It Under (Version) Control
Gitting It Under (Version) Control
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
 
[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis[Kiwicon 2011] Post Memory Corruption Memory Analysis
[Kiwicon 2011] Post Memory Corruption Memory Analysis
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
 
Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15Git basic stanley hsiao 2010_12_15
Git basic stanley hsiao 2010_12_15
 
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
JetBrains Day Seoul - Exploring .NET’s memory management – a trip down memory...
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
 
Platform Clouds, Containers, Immutable Infrastructure Oh My!
Platform Clouds, Containers, Immutable Infrastructure Oh My!Platform Clouds, Containers, Immutable Infrastructure Oh My!
Platform Clouds, Containers, Immutable Infrastructure Oh My!
 
EhTrace -- RoP Hooks
EhTrace -- RoP HooksEhTrace -- RoP Hooks
EhTrace -- RoP Hooks
 
Confraria SECURITY & IT - Lisbon Set 29, 2011
Confraria SECURITY & IT - Lisbon Set 29, 2011Confraria SECURITY & IT - Lisbon Set 29, 2011
Confraria SECURITY & IT - Lisbon Set 29, 2011
 
DotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NETDotNetFest - Let’s refresh our memory! Memory management in .NET
DotNetFest - Let’s refresh our memory! Memory management in .NET
 
[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation
 
An introduction to git
An introduction to gitAn introduction to git
An introduction to git
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis
 
Scale11x lxc talk
Scale11x lxc talkScale11x lxc talk
Scale11x lxc talk
 

Dernier

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 

Dernier (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 

Git Presentation - Purple Scout AB Malmö

  • 1. Git Sébastien Cevey <seb@cine7.net> http://bytes.inso.cc/ Purple Scout presentation (April 17, 2009) Swiss Federal Institute XMMS2 Music Player Playlouder MSP of Technology, Lausanne
  • 2. Outline 1. Introduction 2. Concepts & Local Workflow 3. Distributed Work 4. Advanced Features 5. Conclusion 2
  • 4. Version Control Systems • Record history • Facilitate team work • Expose source code • Branch/merge development paths 4
  • 5. Centralized VCS permissions Master branches Repository commit checkout update Copies Working Working Working Copy Copy Copy Alice Bob Charlie 5
  • 6. Distributed VCS Repository Repository Remote (public/private) push Repository clone pull Working Working Working Copy Copy Copy Local Repository Repository Repository Alice Bob Charlie 6
  • 7. Centralized vs Distributed • • synchronous asynchronous - unique reference - copy = repository - fixed hierarchy - loose hierarchy • • centralized access offline: control - history - commit - branches • • simpler more powerful 7
  • 8. Centralized vs Distributed • • synchronous asynchronous - unique reference - copy = repository - fixed hierarchy - loose hierarchy • • centralized access offline: control - history - commit - branches • • simpler more powerful • • tråkig... ;_; fun! ^_^ 8
  • 9. Git History • Linus Torvalds needed a replacement for BitKeeper to maintain the Linux kernel • Requirements: • Distributed • Non-linear, custom workflows • Scalable & Fast • Talk over HTTP, SSH, FTP, rsync, email, etc • Integrity guarantee • First prototype on April 7, 2005 • Now used by many FOSS projects: Linux kernel, Freedesktop (X.org), Ruby on Rails, XMMS2, Android, Gnome, GCC, etc. 9
  • 10. Why “Git” ? git (plural gits) 2. (British, slang, pejorative) A silly, incompetent, stupid, annoying or childish person. “Jacko is a git.” Linus Torvalds: “I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git.” Alternatively: “Global Information Tracker” 10
  • 11. Git vs. other DVCS (Mercurial, Darcs, Bazaar, Monotone, etc) + Fast, scalable (execution and setup) + Powerful small tools (Unix spirit) + Lively development + Linus (smart design) 11
  • 12. Git vs. other DVCS (Mercurial, Darcs, Bazaar, Monotone, etc) + Fast, scalable (execution and setup) + Powerful small tools (Unix spirit) + Lively development + Linus (smart design) - Learning curve (grasp concepts) - Imperfect on MS Windows - Linus (no library) 12
  • 13. Why Git is better than X? • Cheap Local Branching • Everything is Local • Git is Fast • Git is Small • The Staging Area • Distributed • Any Workflow • Easy to Learn Source: http://whygitisbetterthanx.com/ 13
  • 14. 2. Concepts & Local Workflow 14
  • 15. Git Repository repository = object database .git/objects/ 15
  • 16. Git Repository id(object) = SHA1(object content) 335e a23f 6679 601a 5592 34fe cca6 3347 efa4 dd85 57bc cc39 3e93 2211 5390 8e9b 1798 332e 23a7 1432 1260 93a4 cc5e f943 eab4 b3ca .git/objects/8e/9b... 16
  • 17. Git Repository content is stored in blob objects File #include <stdio.h> 335e a23f 6679 int main () { printf(”Hello World”); 601a 5592 return 0; } 34fe cca6 3347 efa4 dd85 57bc cc39 3e93 2211 5390 8e9b 1798 git cat-file -p 93a4 332e 23a7 1432 1260 93a4 cc5e f943 eab4 b3ca 17
  • 18. Git Repository structure is stored in tree objects Directory 040000 tree cc5e src 100644 blob 93a4 hw.c 335e a23f 6679 601a 5592 34fe cca6 3347 efa4 dd85 57bc cc39 3e93 2211 5390 8e9b 1798 git cat-file -p 1260 332e 23a7 1432 1260 93a4 cc5e f943 eab4 b3ca 18
  • 19. Git Repository history is stored in commit objects Authenticated hierarchical snapshots tree 1260... parent f943... 335e a23f 6679 author Tom <tom@...> 1204666883 +0100 committer Max 601a 5592 <max@...> 1204666883 +0100 34fe cca6 Note: identity is a 3347 efa4 function of the whole Fixed a major bug in dd85 57bc history! Hello World. cc39 3e93 i.e. build-in integrity 2211 5390 check 8e9b 1798 git cat-file -p 1432 332e 23a7 1432 1260 93a4 cc5e f943 eab4 b3ca 19
  • 20. Git Repository references are stored as tag objects (Signed) symbolic link object a23f... type commit tag v1.0.7 335e a23f 6679 tagger Jack <jack@...> 1136523576 -0800 601a 5592 GIT 1.0.7 -----BEGIN PGP SIGNATURE----- 34fe cca6 3347 efa4 Version: GnuPG v1.4.2 (GNU/Linux) dd85 57bc iD8D… cc39 3e93 -----END PGP SIGNATURE----- 2211 5390 8e9b 1798 332e 23a7 git cat-file -p 335e 1432 1260 93a4 cc5e f943 eab4 b3ca 20
  • 21. Git Repository practical repository entry points point to a branches feature-X master commit in git branch symbolic links the graph 335e a23f 6679 tags 601a 5592 34fe cca6 v1.0 3347 efa4 dd85 57bc alpha-3 cc39 3e93 2211 5390 point to an 8e9b 1798 object (usually a 332e 23a7 commit) 1432 1260 93a4 cc5e f943 eab4 git tag b3ca 21
  • 22. History Graph branches feature-X master HEAD a23f tags 601a v1.0 3347 alpha-3 cc39 8e9b 1432 f943 22
  • 24. initialize $ git init Initialized empty Git repository in /path/example/.git/ IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h 24
  • 25. check status $ git status # On branch master # # Initial commit # # Untracked files: # (use quot;git add <file>...quot; to include in what will be committed) # # IDEAS # Makefile # README # src/ nothing added to commit but untracked files present (use quot;git addquot; to track) IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h 25
  • 26. add files $ git add . IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h 26
  • 27. check status $ git status # On branch master # # Initial commit # # Changes to be committed: # (use quot;git rm --cached <file>...quot; to unstage) # # new file: IDEAS # new file: Makefile # new file: README # new file: src/Makefile # new file: src/helloworld.c # new file: src/helloworld.h IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h 27
  • 28. commit $ git commit -a -m quot;First importquot; Created initial commit 04f087b: First import 0 files changed, 0 insertions(+), 0 deletions(-) master create mode 100644 IDEAS create mode 100644 Makefile create mode 100644 README create mode 100644 src/Makefile create mode 100644 src/helloworld.c create mode 100644 src/helloworld.h IDEAS Makefile README src |-- Makefile |-- helloworld.c 04f087b `-- helloworld.h 28
  • 29. hack $ echo quot;Blah blahquot; >> README master $ rm IDEAS Makefile README <- edited src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 29
  • 30. check status $ git status # On branch master # Changed but not updated: master # (use quot;git add/rm <file>...quot; to update what will be committed) # # deleted: IDEAS # modified: README # no changes added to commit (use quot;git addquot; and/or quot;git commit -aquot;) Makefile README <- edited src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 30
  • 31. commit $ git commit -a -m quot;More stuffquot; Created commit 54eda77: More stuff 1 files changed, 1 insertions(+), 0 deletions(-) master delete mode 100644 IDEAS Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 31
  • 32. view commit $ git show commit 54eda77a85b0e5d1891653a36ff08faf133df030 Author: Sebastien Cevey <seb@cine7.net> master Date: Mon Apr 13 21:23:02 2009 +0200 More stuff diff --git a/IDEAS b/IDEAS deleted file mode 100644 index e69de29..0000000 diff --git a/README b/README index e69de29..579c5b1 100644 --- a/README +++ b/README @@ -0,0 +1 @@ +Blah blah Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 32
  • 33. view commit $ git show --pretty=raw commit 54eda77a85b0e5d1891653a36ff08faf133df030 tree 524f0cfe293064d18ac0c12a55baaf2b34d42e8d master parent 04f087b23ce96c2b24f9f6b5f7cf437af33e19c6 author Sebastien Cevey <seb@cine7.net> 1239650582 +0200 committer Sebastien Cevey <seb@cine7.net> 1239650582 +0200 More stuff [...] Makefile README 54eda77 524f0c src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 33
  • 34. view history $ git log commit 54eda77a85b0e5d1891653a36ff08faf133df030 Author: Sebastien Cevey <seb@cine7.net> master Date: Mon Apr 13 21:23:02 2009 +0200 More stuff commit 04f087b23ce96c2b24f9f6b5f7cf437af33e19c6 Author: Sebastien Cevey <seb@cine7.net> Date: Mon Apr 13 21:11:58 2009 +0200 First import Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 34
  • 35. hack again $ echo quot;/* End of fil */quot; >> src/helloworld.c master Makefile README 54eda77 src |-- Makefile |-- helloworld.c <- edited `-- helloworld.h 04f087b 35
  • 36. diff modifs $ git diff diff --git a/src/helloworld.c b/src/helloworld.c index e69de29..54a606d 100644 master --- a/src/helloworld.c +++ b/src/helloworld.c @@ -0,0 +1 @@ +/* End of fil */ Makefile README 54eda77 src |-- Makefile |-- helloworld.c <- edited `-- helloworld.h 04f087b 36
  • 37. commit $ git commit -a -m “Hasty commit” Created commit 3b5ba16: Hasty commit 1 files changed, 1 insertions(+), 0 deletions(-) master 3b5ba16 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 37
  • 38. rewind history $ git reset --hard HEAD^ # parent of HEAD HEAD is now at 54eda77 More stuff master $ git status # On branch master nothing to commit (working directory clean) Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 38
  • 39. rewind history $ git reset HEAD^ # parent of HEAD src/helloworld.c: locally modified master $ git diff diff --git a/src/helloworld.c b/src/helloworld.c index e69de29..54a606d 100644 --- a/src/helloworld.c +++ b/src/helloworld.c @@ -0,0 +1 @@ +/* End of fil */ Makefile README 54eda77 src |-- Makefile |-- helloworld.c <- edited `-- helloworld.h 04f087b 39
  • 40. new history $ $EDITOR src/helloworld.c $ git commit -a -m quot;Proper commitquot; master Created commit 0657c63: Proper commit 1 files changed, 1 insertions(+), 0 deletions(-) 0657c63 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 40
  • 41. tag $ git tag stable master stable 0657c63 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 41
  • 42. new branch $ git branch feature-X 54eda77 feature-X master $ git branch feature-X * master stable 0657c63 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 42
  • 43. switch branch $ git checkout feature-X Switched to branch quot;feature-Xquot; feature-X master $ git branch * feature-X master stable 0657c63 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 43
  • 44. commit branch $ $EDITOR src/helloworld.c feature-X master $ git commit -a -m quot;Work on Xquot; Created commit 6195849: Work on X 1 files changed, 1 insertions(+), 0 deletions(-) stable 0657c63 6195849 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 44
  • 45. commit branch $ $EDITOR README feature-X master $ git commit -a -m quot;Edit README for Xquot; Created commit 20fbfdd: Edit README for X 1 files changed, 1 insertions(+), 0 deletions(-) 20fbfdd stable 0657c63 02bbf10 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 45
  • 46. diff branches $ git checkout master Switched to branch quot;masterquot; feature-X master $ git diff feature-X diff --git a/README b/README index 29a6a68..579c5b1 100644 --- a/README +++ b/README @@ -1,2 +1 @@ Blah blah -foo [...] 1e4cfe4 stable 0657c63 02bbf10 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 46
  • 47. merge $ git merge feature-X Merge made by recursive. feature-X README | 1+ master src/helloworld.h | 1 + 2 files changed, 2 insertions(+), 0 deletions(-) 69e105 1e4cfe4 stable 0657c63 02bbf10 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 47
  • 48. view merge commit $ git show commit 69e105f3d1991c34d74d079197d5f1b1917d3120 feature-X Merge: 0657c63... 20fbfdd... master Author: Sebastien Cevey <seb@cine7.net> Date: Mon Apr 13 22:49:16 2009 +0200 Merge branch 'feature-X' 69e105 1e4cfe4 stable 0657c63 02bbf10 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 48
  • 49. undo $ git reset --hard stable # undo last merge HEAD is now at 0657c63 Proper commit feature-X master $ git checkout feature-X Switched to branch quot;feature-Xquot; 20fbfdd stable 0657c63 02bbf10 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 49
  • 50. rebase $ git rebase master First, rewinding head to replay your work on top of it... feature-X Applying: Work on X master Applying: Edit README for X $ git show-branch * [feature-X] Edit README for X ! [master] Proper commit aeaf0a -- * [feature-X] Edit README for X * [feature-X^] Work on X *+ [master] Proper commit 2e309b stable 0657c63 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 50
  • 51. trivial merge $ git checkout master Switched to branch quot;masterquot; feature-X master $ git merge feature-X Updating 0657c63..aeaf0a9 Fast forward README | 1+ src/helloworld.h | 1 + aeaf0a 2 files changed, 2 insertions(+), 0 deletions(-) 2e309b stable 0657c63 Makefile README 54eda77 src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 51
  • 56. public repository t aul r ste f seg ma fix- D C E B public repo A 56
  • 57. clone t aul r ste f seg ma fix- (over local filesystem, ssh://, git://, rsync://, ftp://etc) D C E B lt fau r ste public repo A seg ma fix- $ git clone $URL Initialized empty Git repository in local/ copy/.git/ D C E B local repo A 57
  • 58. branch namespace t aul r ste f seg ma fix- D C E origin/ B lt fau r r ste ste public repo A seg ma ma fix- $ git branch --all *master origin/HEAD D origin/fix-segfault C E origin/master B local repo A 58
  • 59. public repository updated t aul r ste f seg ma fix- D F C E origin/ B lt fau r r ste ste public repo A seg ma ma fix- D C E B local repo A 59
  • 60. fetch update t aul r ste f seg ma fix- D F C E origin/ B lt fau r r ste ste public repo A seg ma ma fix- $ git fetch origin remote: Counting objects: 5, done. remote: Compressing objects: 100% (2/2), done. D F remote: Total 3 (delta 0), reused 0 (delta 0) C E Unpacking objects: 100% (3/3), done. From /public/repo B E..F fix-segfault -> origin/fix-segfault local repo A 60
  • 61. checkout tracking branch t aul r ste f seg ma fix- “topic branch” “tracking branches” D F C E origin/ B lt fau r r rk ste ste public repo A seg wo ma ma fix- $ git checkout -b work origin/fix-segfault D F Branch work set up to track remote branch refs/remotes/origin/fix-segfault. C E Switched to a new branch quot;workquot; B local repo A 61
  • 62. commit topic branch t aul r ste f seg ma fix- D F origin/ C E lt fau r r rk ste ste public repo B seg wo ma ma fix- $ $EDITOR $ git commit -a -m quot;Another fixquot; G [...] D F C E local repo B 62
  • 63. push new commit t aul r ste f seg ma fix- G D F origin/ C E lt fau r r rk ste ste public repo B seg wo ma ma fix- $ git push origin work:fix-segfault Total 0 (delta 0), reused 0 (delta 0) G To /public/repo F..G work -> feature-X D F C E local repo B 63
  • 64. public repository updated t aul r ste f seg ma fix- H G origin/ D F lt fau r r rk ste ste public repo C E seg wo ma ma fix- G D F C E local repo B 64
  • 65. fetch update t aul r ste f seg ma fix- H G origin/ D F lt fau r r rk ste ste public repo C E seg wo ma ma fix- $ git fetch origin [...] H From /public/repo G..H fix-segfault -> origin/fix-segfault G D F local repo C 65
  • 66. pull to merge update t aul r ste f seg ma fix- H G origin/ D F lt fau r r rk ste ste public repo C E seg wo ma ma fix- $ git pull origin Updating G..H H Fast forward README | 1 + G 1 files changed, 1 insertions(+), 0 deletions(-) D F local repo C 66
  • 67. Basic multi-repo commands • git clone: init a copy of a repository • git fetch: sync remote repo R with local branches R/* • git pull: fetch + merge • git push <repo> [<local-branch>:<remote-branch>] 67
  • 68. ma ste r wo rk pre -m e rge ma ste dev/ r ma ste r tes t bug gy- cra dev p 68 ma ste r exp eri me nta l fix- seg f aul anna t Real-life layout stable/ ma ste r ma ste r fix- seg fau lt fix- seg f local repo aul t stable
  • 69. ma ste r wo rk pre -m e rge ma ste dev/ r ma ste r tes t bug gy- cra dev p git remote add anna $URL anna/ 69 ma ste r exp eri me nta l fix- seg f aul anna t Real-life layout stable/ ma ste r ma ste r fix- seg fau lt fix- seg f local repo aul t stable
  • 70. ma ste r wo rk pre -m e rge ma ste dev/ r ma ste r tes t bug gy- cra dev p anna/ 70 ma git fetch anna ste r exp eri ma me ste nt r al fix- exp seg eri fau lt me nta l fix- seg f aul anna t Real-life layout stable/ ma ste r ma ste r fix- seg fau lt fix- seg f local repo aul t stable
  • 71. ma ste r not in .git/” “just a repo, wo git --bare init rk pre -m mine e rge ma ste dev/ r ma ste r tes t bug gy- cra dev p anna/ 71 ma ste r exp eri ma me ste nt r al fix- exp seg eri fau lt me nta l fix- seg f aul anna t Real-life layout stable/ ma ste r ma ste r fix- seg fau lt fix- seg f local repo aul t stable
  • 72. ma ste r wo rk pre -m mine e rge ma ste dev/ r ma ste r tes t git remote add mine $URL bug gy- cra dev p anna/ 72 ma ste r exp eri ma me ste nt r al fix- exp seg eri fau lt me nta l fix- seg f aul anna t Real-life layout stable/ ma ste r ma ste r fix- seg fau lt fix- seg f local repo aul t stable
  • 73. ma ste r ma ste r wo rk pre -m erg e pre -m mine e rge ma mine/ ste ma r ste r tes t pre -m e rge bug gy- cra dev p 73 dev/ ma ma ste r ste r exp eri me git push mine work:master pre-merge nta l fix- anna/ seg f ma aul anna t Real-life layout ste r exp eri me nt al ma fix- ste “remotes” r seg fau lt fix- seg f aul t stable stable/ local repo ma ste r
  • 74. git remote • Help track remote (i.e. other) repositories • Pull from / push to them • Use tracking branches like any branch (merge, rebase, diff, log, show, etc) 74
  • 75. e.g. XMMS2 trees Official trees stable devel Developer public public public trees theefer tru Local trees Joe Sixpack tru anders theefer user maintainers developer 75
  • 76. e.g. XMMS2 trees stable devel olof’s server public public olof public theefer tru olof Joe Sixpack tru anders theefer contributer user maintainers developer 76
  • 78. Between the working directory and the repository Repository Working master Directory IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 78
  • 79. The Index (or “Staging Area”) Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b 79
  • 80. Committing using the index Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h git add/rm git commit 04f087b 80
  • 81. Bypassing the Index Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h 04f087b git commit -a 81
  • 82. new file Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h test.c <- new file TODO <- new file 04f087b 82
  • 83. $ git status new file # On branch master # Changed but not updated: # (use quot;git add <file>...quot; to update what will be committed) # # modified: test.c # modified: TODO Index # no changes added to commit (use quot;git addquot; and/or quot;git commit -aquot;) IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h test.c <- new file TODO <- new file 04f087b 83
  • 84. new file: add to index Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO <- new file IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h test.c <- new file TODO git add TODO 04f087b 84
  • 85. new file: add to index $ git status # On branch master # Changes to be committed: Index # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: TODO IDEAS # Makefile Repository README # Changed but not updated: [...] Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO <- new file IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h test.c <- new file TODO git add TODO 04f087b 85
  • 86. new file: commit index Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef test.c <- new file TODO git commit 04f087b 86
  • 87. edited file Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO IDEAS Makefile README <- edited src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef test.c <- new file TODO 04f087b 87
  • 88. edited file: update index Index IDEAS Makefile Repository README <- edited Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO IDEAS Makefile README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef test.c <- new file TODO git add README 04f087b 88
  • 89. edited file: commit index Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO IDEAS Makefile f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef test.c <- new file TODO git commit 04f087b 89
  • 90. edited file Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO IDEAS <- 3 hunks Makefile f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef test.c <- new file TODO 04f087b 90
  • 91. add selected hunks to index Index IDEAS <- 1 hunk Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO IDEAS <- 2 hunks Makefile f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef (also see git add --interactive) test.c <- new file TODO git add -p IDEAS 04f087b 91
  • 92. add selected hunks to index Index $ git add -p src/xmms/testclient.c [...] @@ -44,7 +44,7 @@ int main (int argc, char **argv) 1 hunk IDEAS <- Makefile Repository fd = xmms_ipc_transport_fd_get (transport); README Working src |-- Makefile - msg = xmms_ipc_msg_string_new (42, quot;korv!quot;); master Directory |-- helloworld.c + msg = xmms_ipc_msg_string_new (42, quot;apan!quot;); `-- helloworld.h TODO i = 5; IDEAS <- 2 hunks Makefilethis hunk [y/n/a/d/j/J/?]? Stage f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef (also see git add --interactive) test.c <- new file TODO git add -p IDEAS 04f087b 92
  • 93. diff’ing options Index IDEAS <- 1 hunk Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c git diff --cached `-- helloworld.h TODO IDEAS <- 2 hunks Makefile f4ec56 README src git diff |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef test.c <- new file TODO git diff HEAD 04f087b 93
  • 94. Conflicts: marked in index Index IDEAS <- conflicted Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO IDEAS <- merged Makefile f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef TODO 04f087b 94
  • 95. Reset changes: 3 options Index IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h TODO IDEAS Makefile f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef TODO 04f087b 95
  • 96. reset --hard reset the repository HEAD, the index Index and the working deadbeef directory. IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h deadbeef TODO IDEAS Makefile f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h git reset --hard deadbeef deadbeef TODO Warning: any uncommitted 04f087b change is lost! 96
  • 97. reset --soft only reset the repository HEAD. Index f4ec56 IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h f4ec56 TODO IDEAS Makefile f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef git reset --soft deadbeef TODO Previous commit becomes 04f087b “changes to be committed”. 97
  • 98. reset --mixed (default) reset the repository HEAD and the Index index, but not the deadbeef working directory. IDEAS Makefile Repository README Working src |-- Makefile master Directory |-- helloworld.c `-- helloworld.h f4ec56 TODO IDEAS Makefile f4ec56 README src |-- Makefile |-- helloworld.c `-- helloworld.h deadbeef git reset --mixed deadbeef TODO Keep changes but not 04f087b marked for commit. 98
  • 99. Using the Index (or not) • “Invisible” area to prepare commits • Interact with: - working directory (add, rm) - repository (reset, commit) • Analyze state (status, diff) • Can usually be bypassed (using -a) • Warning: - Can commit files in inconsistent state (e.g. not tested) 99
  • 100. Git layers Source: http://osteele.com/archives/2008/05/commit-policies 100
  • 101. Rewrite history! • Changing the history = point to a new history • Correct mistakes • Cleanup messy iterative development • Warning: - Changes commit ids - (Possibly) creates conflicts if when people merge the rewritten branch - Best used locally, not on an important tree 101
  • 102. Rewrite history! (1) • git commit --amend r ste ma • “Replace the latest commit by the current state of the index” K D • Allows to keep or edit the C commit message B A 102
  • 103. Rewrite history! (1) • git commit --amend r ste ma • “Replace the latest commit by the current state of the index” D K • Allows to keep or edit the C commit message B A 103
  • 104. Rewrite history! (2) • git rebase --interactive r ste ma • Rewrite a sequence of commits: - omit F - squash with parent E - edit D C B A 104
  • 105. Rewrite history! (2) • git rebase --interactive r ste ma • Rewrite a sequence of commits: - omit F T (E+F) - squash with parent E - edit D S (D) C B B A 105
  • 106. Rewrite history! (3) • git filter-branch • Rewrite history using functions/scripts • Edit author infos, commit message, directories, commits, tags, etc. • RTFM... 106
  • 107. git bisect • Useful to find the commit that introduces a problem r ste ma • git bisect start <bad> [<good>] HEAD H D C B A 107
  • 108. git bisect • Useful to find the commit that introduces a problem r ste ma • git bisect start <bad> [<good>] H • git bisect bag|good D C B HEAD A 108
  • 109. git bisect • Useful to find the commit that introduces a problem r ste ma • git bisect start <bad> [<good>] H • git bisect bag|good D HEAD C B A 109
  • 110. git bisect • Useful to find the commit that introduces a problem r ste ma • git bisect start <bad> [<good>] H • git bisect bag|good HEAD D C B A 110
  • 111. git blame • git blame D <file> r ste ma H HEAD D C B A 111
  • 112. git stash • git stash [save [message]] r ste • git stash apply ma • git stash pop # apply and drop modifs • Can also preserve the state of the index 112
  • 113. git stash • git stash [save [message]] {0} r ste sh@ • git stash apply ma sta • git stash pop # apply and drop modifs • Can also preserve the state of the index 113
  • 114. git stash • git stash [save [message]] {0} r ste sh@ • git stash apply ma sta • git stash pop # apply and drop modifs • Can also preserve the state of the index 114
  • 115. git stash • git stash [save [message]] {0} r ste sh@ • git stash apply ma sta • git stash pop # apply and drop modifs modifs • Can also preserve the state of the index 115