SlideShare une entreprise Scribd logo
1  sur  193
Git going
                       DVCS
             with
                                n bending
                    mental spoo
       minutes of
    90
                        ode control
            ia source c
          v



1                              by Matthew McCullough of Ambient Ideas, LLC
“   Git
        -noun                    sant or
                          unplea
                Slang. an
        British
                                    ”
                        per son
              emptible
        cont
                                      ionar y
                                rd English Dict
                          -Oxfo




2
astard, and
          otistical b
“
I'm an eg
                  projects
           all my
    I name
           yself. Fi rst Linux,
    after m
          git. ”
    now
                          us Torvalds
                     -Lin
RCS

Folders
Clear
           Source   Case
            Safe
                    CVS
           PVCS
     RCS

Folders
Subversion
                            BitKeeper

                                  Perforce
                    Clear
           Source   Case
            Safe
                    CVS
           PVCS
     RCS

Folders
darcs
                                                     Mercurial


                                                           Bazaar

                                        Subversion
                            BitKeeper

                                  Perforce
                    Clear
           Source   Case
            Safe
                    CVS
           PVCS
     RCS

Folders
t
Source Code Control
Gi
Gi
Source Code Control

      t
CultureChange

8
=Don’t
Centralized
      VCS
Innovate




16
Experiment




16
Safely Be Wrong



16
Drive-by Assist

16
Crowd Source
16
18
19
Global Git Settings

     git config --global user.name quot;Hal Smithquot;




20
Global Git Settings

     git config --global user.name quot;Hal Smithquot;

     git config --global user.email quot;hal@bnl.comquot;




20
Global Git Settings

     git config --global user.name quot;Hal Smithquot;

     git config --global user.email quot;hal@bnl.comquot;

                                             ues
                                         val
                                     ent
                                  urr
                               tc
                           tpu
                        Ou
     git config --list

20
Creating a Repo

     mkdir myproj.git




21
Creating a Repo

     mkdir myproj.git
     cd myproj.git




21
Creating a Repo

     mkdir myproj.git
     cd myproj.git
                               lks!
                           t fo
                      ’s i
                  hat
     git init   T




21
22
22
Who’s Got   Git?

23
Hashes and
           Integrity


28
SHA-1 Hash
     Index vs. Hash
     ‣ Centralized VCS uses DB auto-increment index.
     ‣ Git uses SHA-1 hash.
     ‣ Hash for the sake of integrity.

     Hashable Objects
     ‣   Blob
     ‣   Tree
     ‣   Commit
     ‣   Tag
29
SHA-1 Hash
     Index vs. Hash
     ‣ Centralized VCS uses DB auto-increment index.
     ‣ Git uses SHA-1 hash.
     ‣ Hash for the sake of integrity.

     Hashable Objects                           ght
                                           hou
                                        It        ere
     ‣   Blob                               es w
                                         ash
                                       h
     ‣   Tree
                                              for
                                                  rds?
     ‣   Commit
                                             swo
                                          pas
     ‣   Tag
29
http://book.git-scm.com/1_the_git_object_model.html




30
http://book.git-scm.com/1_the_git_object_model.html




30
http://book.git-scm.com/1_the_git_object_model.html




30
http://book.git-scm.com/1_the_git_object_model.html




30
alized
      entr
    C
Alice           Bob
alized
           entr
         C
  Alice              Bob
1 = okay.htm
alized
           entr
         C
  Alice              Bob
1 = okay.htm

2 = fine.htm
alized
           entr
         C
  Alice               Bob
1 = okay.htm

2 = fine.htm    Sync
alized
           entr
         C
  Alice                 Bob
1 = okay.htm          1 = okay.htm

2 = fine.htm           2 = fine.htm
               Sync
alized
           entr
         C
  Alice                  Bob
1 = okay.htm          1 = okay.htm

2 = fine.htm           2 = fine.htm
               Sync
                      3 = good.htm
alized
           entr
         C
  Alice                   Bob
1 = okay.htm           1 = okay.htm

2 = fine.htm            2 = fine.htm
                Sync
                       3 = good.htm

3 = great.htm
alized
           entr
         C
  Alice                   Bob
1 = okay.htm           1 = okay.htm

2 = fine.htm            2 = fine.htm
                Sync
                       3 = good.htm

                Sync
3 = great.htm
alized
           entr
         C
  Alice                   Bob
1 = okay.htm           1 = okay.htm

2 = fine.htm            2 = fine.htm
                Sync
4 = good.htm           3 = good.htm

                Sync
3 = great.htm          4 = great.htm
alized
            entr
          C
   Alice                    Bob
 1 = okay.htm            1 = okay.htm

 2 = fine.htm             2 = fine.htm
                 Sync
ERROR
 4 = good.htm            3 = good.htm


                        ERROR
                 Sync
 3 = great.htm           4 = great.htm
Distributed
Alice         Bob
Distributed
    Alice             Bob
a233b76 = okay.htm
Distributed
    Alice             Bob
a233b76 = okay.htm

d234ab1 = fine.htm
Distributed
    Alice                   Bob
a233b76 = okay.htm

d234ab1 = fine.htm    Sync
Distributed
    Alice                        Bob
a233b76 = okay.htm          a233b76 = okay.htm

d234ab1 = fine.htm           d234ab1 = fine.htm
                     Sync
Distributed
    Alice                        Bob
a233b76 = okay.htm          a233b76 = okay.htm

d234ab1 = fine.htm           d234ab1 = fine.htm
                     Sync
                            f90b12c = good.htm
Distributed
     Alice                        Bob
a233b76 = okay.htm           a233b76 = okay.htm

d234ab1 = fine.htm            d234ab1 = fine.htm
                      Sync
                             f90b12c = good.htm

ae42ba0 = great.htm
Distributed
     Alice                        Bob
a233b76 = okay.htm           a233b76 = okay.htm

d234ab1 = fine.htm            d234ab1 = fine.htm
                      Sync
                             f90b12c = good.htm

                      Sync
ae42ba0 = great.htm
Distributed
     Alice                        Bob
a233b76 = okay.htm           a233b76 = okay.htm

d234ab1 = fine.htm            d234ab1 = fine.htm
                      Sync
f90b12c = good.htm           f90b12c = good.htm

                      Sync
ae42ba0 = great.htm          ae42ba0 = great.htm
Hash Benefits
     Integrity
     ‣ Identifies damaged repos.
     ‣ Prevents modification of published history.
     ‣ Unique to file size and contents.

     Tags
     ‣ Cryptographically sign tags by GPG/email.

     Independence
     ‣ Separation from sequence # of checkin.
35
Location,Location,Location




36
Remote
        is like a special
Stash
                            Repo




                     Index
   Working
Remote
        is like a special
Stash
                            Repo




                     Index
   Working
Remote
        is like a special
Stash
                            Repo
                                   git clone




                     Index
   Working
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout




                     Index
   Working
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout
                                   edit some files



                     Index
   Working
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout
                                   edit some files
                                   git stash

                     Index
   Working
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout
                                   edit some files
                                   git stash
                                   edit some files
                     Index
   Working
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout
                                   edit some files
                                   git stash
                                   edit some files
                     Index         git stash apply
   Working
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout
                                   edit some files
                                   git stash
                                   edit some files
                     Index         git stash apply
   Working                         git add
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout
                                   edit some files
                                   git stash
                                   edit some files
                     Index         git stash apply
   Working                         git add
                                   git commit
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout
                                   edit some files
                                   git stash
                                   edit some files
                     Index         git stash apply
   Working                         git add
                                   git commit
                                   git push
Remote
        is like a special
Stash
                            Repo
                                   git clone
                                   git checkout
                                   edit some files
                                   git stash
                                   edit some files
                     Index         git stash apply
   Working                         git add
                                   git commit
                                   git push
repo
                                               uild
                                             B
     git clone git://somedomain/myproj.git
     cd myproj.git




38
repo
                                               uild
                                             B
     git clone git://somedomain/myproj.git
     cd myproj.git
                                       dex
                                 te in
                             pda
                           U
     git checkout master




38
repo
                                               uild
                                             B
     git clone git://somedomain/myproj.git
     cd myproj.git
                                       dex
                                 te in
                             pda
                           U
     git checkout master

                                                   king
     echo ‘//Comments’ >> ClassOne.java         or
                                          dit w
     echo ‘//Thoughts’ >> ClassTwo.java E




38
repo
                                                  uild
                                                B
     git clone git://somedomain/myproj.git
     cd myproj.git
                                         dex
                                   te in
                               pda
                             U
     git checkout master

                                                   king
     echo ‘//Comments’ >> ClassOne.java         or
                                          dit w
     echo ‘//Thoughts’ >> ClassTwo.java E
                                        ndex
                                   to i
                               Add                    epo
     git add ClassOne.java                       to r
                                             ave
                             comments’ S
     git commit -m’Added


38
repo
                                                   uild
                                                 B
     git clone git://somedomain/myproj.git
     cd myproj.git
                                           dex
                                     te in
                                 pda
                               U
     git checkout master

                                                   king
     echo ‘//Comments’ >> ClassOne.java         or
                                          dit w
     echo ‘//Thoughts’ >> ClassTwo.java E
                                        ndex
                                   to i
                               Add                    epo
     git   add ClassOne.java                     to r
                                             ave
           commit -m’Added comments’ S
     git
                             ash
                          st
                     h to
           stash Pus
     git
38
Single Stage Thinking

     Subversion
         svn commit
     ‣
     ‣   Adds everything modified.
     ‣   Must list if you want specific files.
     ‣   What if you check in your password?



39
$ echo //password >> Matt1.java
     $ echo //password >> Matt2.java




40
$ echo //password >> Matt1.java
     $ echo //password >> Matt2.java

     $ svn status
     M      Matt1.java
     M      Matt2.java




40
$ echo //password >> Matt1.java
     $ echo //password >> Matt2.java

     $ svn status
     M      Matt1.java
     M      Matt2.java

     $ svn commit -m'Matts checkin'
     Adding         Matt1.java
     Adding         Matt2.java
     Transmitting file data .
     Committed revision 2.

40
Three Stage Thinking
     Git
         git add
     ‣
         git commit
     ‣
         git push
     ‣
     ‣   Commits only what is added to the index.
     ‣   Opportunity to change history locally.
     ‣   Selectively share with other repos.


41
$ echo //SECRETPASSWORD >> mattfile1.java
     $ echo //NewText2 >> mattfile2.java




42
$ echo //SECRETPASSWORD >> mattfile1.java
     $ echo //NewText2 >> mattfile2.java

     $ git status
     # On branch master
     # Changed but not updated:
     #       modified:   mattfile1.txt
     #       modified:   mattfile2.txt




42
$ echo //SECRETPASSWORD >> mattfile1.java
     $ echo //NewText2 >> mattfile2.java

     $ git status
     # On branch master
     # Changed but not updated:
     #       modified:   mattfile1.txt
     #       modified:   mattfile2.txt
                                            dex
                                       o in
                                   int
                               Put
     $ git add mattfile1.txt




42
$ echo //SECRETPASSWORD >> mattfile1.java
     $ echo //NewText2 >> mattfile2.java

     $ git status
     # On branch master
     # Changed but not updated:
     #       modified:   mattfile1.txt
     #       modified:   mattfile2.txt
                                            dex
                                       o in
                                   int
                               Put
     $ git add mattfile1.txt
                                                    epo
                                               to r
                                           ave
                                         S
     $ git commit -m'Matts pw checkin'
     [master]: created ddcdf18: quot;Matts changesquot;
      1 files changed, 1 insertions(+), 0 deletions(-)


42
#$%^&!
     I just committed my password!




43
Change History
     $ git reset --hard HEAD^
     HEAD is now at 9de4cd3 First checkin

     $ git log
     commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993
     Author: Matthew McCullough
     <matthewm@ambientideas.com>
     Date:   Wed Mar 4 23:09:17 2009 -0700
         First checkin



44
Change History
                                                      mit
                                                  com
                                            the
                                        way
                                     wa
                                 hro
                               T
     $ git reset --hard HEAD^
     HEAD is now at 9de4cd3 First checkin

     $ git log
     commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993
     Author: Matthew McCullough
     <matthewm@ambientideas.com>
     Date:   Wed Mar 4 23:09:17 2009 -0700
         First checkin



44
Change History
                                                      mit
                                                  com
                                            the
                                        way
                                     wa
                                 hro
                               T
     $ git reset --hard HEAD^
     HEAD is now at 9de4cd3 First checkin

     $ git log
     commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993
     Author: Matthew McCullough
     <matthewm@ambientideas.com>
     Date:   Wed Mar 4 23:09:17 2009 -0700
         First checkin



44
GitMathematics




45
Directed Acyclic Graph
       a32



             2e2



     8b3


             4e8
Directed Acyclic Graph
                         Ann’s Feature
       a32         5fa



             2e2



     8b3


             4e8
Directed Acyclic Graph
                         Ann’s Feature
       a32         5fa



             2e2



     8b3


             4e8
Directed Acyclic Graph
                          Ann’s Feature
       a32         5fa


                          Tim’s Feature
             2e2    d19



     8b3


             4e8
Directed Acyclic Graph
                               Ann’s Feature
       a32         5fa


                               Tim’s Feature
             2e2    d19

                                   Linus’ rewrite of
                                     Tim’s feature
     8b3                 e69


             4e8
Directed Acyclic Graph
                               Ann’s Feature
       a32         5fa


                               Tim’s Feature
             2e2    d19

                                   Linus’ rewrite of
                                     Tim’s feature
     8b3                 e69


             4e8
WorkingOffline

47
Offline Anything
      Checkin




48
Offline Anything
      Checkin
      Add
      Branch
      List change log
      Grep history
      Rewrite history
      Stash
      Merge
      Label
      Remove

48
Offline Anything
      Checkin
      Add
      Branch
      List change log
      Grep history
      Rewrite history
      Stash
      Merge
      Label
      Remove
      practically everything but push
48
Offline Anything
      Checkin
      Add
      Branch
      List change log
      Grep history
      Rewrite history
      Stash
      Merge
      Label
      Remove
      practically everything but push
48
Hooray! Another
checkin to my latest OSS
        project!
Hooray! Another
             checkin to my latest OSS
                     project!




   I think I liked
subversion better...
UsageModels




50
Centralized
Central
 Repo
Centralized
Central
 Repo
Repo
               Blessed




Dictatorship
Repo
               Blessed




Dictatorship
Repo
               Blessed




Dictatorship
Repo
               Blessed




Dictatorship
Repo
               Blessed




Dictatorship
Certified




                         Integration Managed
           Development
 Repo         Repo
Certified




                         Integration Managed
           Development
 Repo         Repo
Certified




                         Integration Managed
           Development
 Repo         Repo
Certified




                         Integration Managed
           Development
 Repo         Repo
Mirror           Mirror

Certified       Development
 Repo             Repo




                                Mirrored
Mirror           Mirror

Certified       Development
 Repo             Repo




                                Mirrored
Mirror           Mirror

Certified       Development
 Repo             Repo




                                Mirrored
Mirror           Mirror

Certified       Development
 Repo             Repo




                                Mirrored
Mirror           Mirror

Certified       Development
 Repo             Repo




                                Mirrored
☚ Private            Public ☛




                   GitHub




Custom + Public Contrib
☚ Private            Public ☛




                   GitHub




Custom + Public Contrib
☚ Private               Public ☛




         Customized
                      GitHub




Custom + Public Contrib
☚ Private               Public ☛




         Customized
                      GitHub




Custom + Public Contrib
☚ Private               Public ☛




         Customized
                      GitHub




Custom + Public Contrib
Speed
56
Init               Add               Status               Diff
                                                                                      Branch (Cold/Hot)




git   hg     bzr   git   hg    bzr   git     hg     bzr   git   hg     bzr

      Tag                Log         Commit (Lg)          Commit (Sm)




                                                                             git c      git h    hg c     hg h     bzr c bzr h
git   hg     bzr   git   hg    bzr   git     hg     bzr   git   hg     bzr




                                                                                     data from http://whygitisbetterthanx.com/#git-is-fast
Sharing


58
Serving It Up
     Network
     ‣ git instaweb. Built in, read-only, HTTP.
     ‣ git daemon. Custom socket language.
     ‣ gitosis. Easy permissions control.
     ‣ github. Open source & private repos.
     ‣ ssh. OS controlled permissions.
59
60
61
Serving It Up

     Filesystem
     ‣ Local folders. Yes, they can be “remotes.”
     ‣ Mapped network drives. Just like folders.


62
on
                                                     aem
                                                 it d
                                               g
     git clone git://somehost.org/myproj.git




63
on
                                                     aem
                                                 it d
                                               g
     git clone git://somehost.org/myproj.git
                                                        SSH
     git clone mccm06@somehost.org:myproj.git




63
on
                                                      aem
                                                  it d
                                                g
     git clone git://somehost.org/myproj.git
                                                         SSH
     git clone mccm06@somehost.org:myproj.git
                                                   TTP
                                                 H
     git clone http://somehost.org/myproj.git




63
on
                                                          aem
                                                      it d
                                                    g
     git clone git://somehost.org/myproj.git
                                                             SSH
     git clone mccm06@somehost.org:myproj.git
                                                       TTP
                                                     H
     git clone http://somehost.org/myproj.git
                                              tem
                                          sys
                                   File
     git clone ~/work/myproj.git




63
on
                                                          aem
                                                      it d
                                                    g
     git clone git://somehost.org/myproj.git
                                                             SSH
     git clone mccm06@somehost.org:myproj.git
                                                       TTP
                                                     H
     git clone http://somehost.org/myproj.git
                                              tem
                                          sys
                                   File
     git clone ~/work/myproj.git
                                                        rive
                                                   rk d
                                               two
                                            Ne
     git clone z:someservermyproj.git


63
VCS Interop


64
Serversion
     git svn clone http://unfurl.com/trunk
     git svn dcommit


     ‣ First class compatibility.
     ‣ Round trip support.
     ‣ Git commits = svn commits.
65
66
GUIs

67
GitX




68
gitSafe




69
GitK




70
GitGUI




71
6
reasons
Cherry Pick



              ❻
     ‣git cherry-pick a5b2ee




73
Cherry Pick



                  ❻
     ‣git cherry-pick a5b2ee
     ‣Merge in just one commit.




73
Cherry Pick



                  ❻
     ‣git cherry-pick a5b2ee
     ‣Merge in just one commit.
     ‣When you want a nugget, not a branchload.


73
Gives Credit



                  ❺
     ‣Tracks who authors a change.




74
Gives Credit



                  ❺
     ‣Tracks who authors a change.
     ‣“Author” even survives passing through reviewers.




74
Gives Credit



                   ❺
     ‣Tracks who authors a change.
     ‣“Author” even survives passing through reviewers.
     ‣“Author” survives all merges.



74
Gives Credit



                   ❺
     ‣Tracks who authors a change.
     ‣“Author” even survives passing through reviewers.
     ‣“Author” survives all merges.
     ‣Additionally tracks who committed a change.


74
Bisect Bugs



              ❹
     ‣git bisect run mvn test




75
Bisect Bugs



                   ❹
     ‣git bisect run mvn test
     ‣Binary-search for bug.




75
Bisect Bugs



                   ❹
     ‣git bisect run mvn test
     ‣Binary-search for bug.
     ‣Manual or automated modes.



75
Bisect Bugs



                   ❹
     ‣git bisect run mvn test
     ‣Binary-search for bug.
     ‣Manual or automated modes.
     ‣Yak cruelty-prevention.


75
Squash Verbosity



              ❸
     ‣git merge --squash mybranch




76
Squash Verbosity



                  ❸
     ‣git merge --squash mybranch
     ‣Reduce all your micro-checkins to block commits.




76
Squash Verbosity



                   ❸
     ‣git merge --squash mybranch
     ‣Reduce all your micro-checkins to block commits.
     ‣Make mistakes, revise, checkin without hesitation.



76
Squash Verbosity



                   ❸
     ‣git merge --squash mybranch
     ‣Reduce all your micro-checkins to block commits.
     ‣Make mistakes, revise, checkin without hesitation.
     ‣Great for SVN compatibility.


76
Search History



              ❷
     ‣git grep SomeText HEAD^^^




77
Search History



                   ❷
     ‣git grep SomeText HEAD^^^
     ‣Search in file history without checkout.




77
Search History



                   ❷
     ‣git grep SomeText HEAD^^^
     ‣Search in file history without checkout.
     ‣Greps contents.


77
Rebase



              ❶
     ‣git rebase master




78
Rebase



                   ❶
     ‣git rebase master
     ‣Reposition your feature branch’s start point.




78
Rebase



                   ❶
     ‣git rebase master
     ‣Reposition your feature branch’s start point.
     ‣Makes for simpler merge graphs.



78
Rebase



                   ❶
     ‣git rebase master
     ‣Reposition your feature branch’s start point.
     ‣Makes for simpler merge graphs.
     ‣Sustains feature-branch work clarity.


78
79
Tomorrow’s VCS, Today
tthew
                                 Ma
     Twitter
      @matthewmccull
     Blog
      http://www.ambientideas.com/blog
              sidebar has all my social media links


     Email
      matthewm@ambientideas.com
     GitHub
      http://github.com/matthewmccullough
81
Resources
     Git Homepage
     http://git-scm.com

     Directed Acrylic Graph
     http://en.wikipedia.org/wiki/Directed_acyclic_graph

     Git for Computer Scientists
     http://eagain.net/articles/git-for-computer-scientists/

     Git Treeish
     http://book.git-scm.com/4_git_treeishes.html
82
Resources
     Git Docs
     http://www.kernel.org/pub/software/scm/git/docs/

     Git Magic eBook
     http://www-cs-students.stanford.edu/~blynn/gitmagic/book.pdf

     Linus Torvald’s Git talk at Google
     http://www.youtube.com/watch?v=4XpnKHJAok8

     CygWin
     http://www.cygwin.com
83
Resources
     MSysGit
     http://code.google.com/p/msysgit

     Git Cheetah
     http://code.google.com/p/msysgit/wiki/GitCheetah

     Matthew’s Git Bookmarks
     http://delicious.com/matthew.mccullough/git

     Matthew’s Bash Prompt
     http://gist.github.com/47267
84
Image Credits
     ‣   http://www.ambientideasphotography.com
     ‣   http://flickr.com/photos/lenore-m/2903856664/
     ‣   http://en.wikipedia.org/wiki/Git_(software)
     ‣   http://flickr.com/photos/karenhorton/1583513014/
     ‣   http://flickr.com/photos/mashdnart/2545782407/
     ‣   http://commons.wikimedia.org/wiki/
         File:Small_Boy_nuclear_test_1962.jpg
     ‣   http://www.flickr.com/photos/knmurphy/2506896257/
     ‣   http://www.flickr.com/photos/albyspace/1022035568/
     ‣   http://flickr.com/photos/michaelhays/3070238360/
     ‣   http://flickr.com/photos/d_vdm/509996632/
85

Contenu connexe

Plus de Matthew McCullough

Git Graphs, Hashes, and Compression, Oh My
Git Graphs, Hashes, and Compression, Oh MyGit Graphs, Hashes, and Compression, Oh My
Git Graphs, Hashes, and Compression, Oh MyMatthew McCullough
 
Git and GitHub at the San Francisco JUG
 Git and GitHub at the San Francisco JUG Git and GitHub at the San Francisco JUG
Git and GitHub at the San Francisco JUGMatthew McCullough
 
Migrating from Subversion to Git and GitHub
Migrating from Subversion to Git and GitHubMigrating from Subversion to Git and GitHub
Migrating from Subversion to Git and GitHubMatthew McCullough
 
Build Lifecycle Craftsmanship for the Transylvania JUG
Build Lifecycle Craftsmanship for the Transylvania JUGBuild Lifecycle Craftsmanship for the Transylvania JUG
Build Lifecycle Craftsmanship for the Transylvania JUGMatthew McCullough
 
Git Going for the Transylvania JUG
Git Going for the Transylvania JUGGit Going for the Transylvania JUG
Git Going for the Transylvania JUGMatthew McCullough
 
Transylvania JUG Pre-Meeting Announcements
Transylvania JUG Pre-Meeting AnnouncementsTransylvania JUG Pre-Meeting Announcements
Transylvania JUG Pre-Meeting AnnouncementsMatthew McCullough
 
Game Theory for Software Developers at the Boulder JUG
Game Theory for Software Developers at the Boulder JUGGame Theory for Software Developers at the Boulder JUG
Game Theory for Software Developers at the Boulder JUGMatthew McCullough
 
Cascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUGCascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUGMatthew McCullough
 

Plus de Matthew McCullough (20)

Adam Smith Builds an App
Adam Smith Builds an AppAdam Smith Builds an App
Adam Smith Builds an App
 
Git's Filter Branch Command
Git's Filter Branch CommandGit's Filter Branch Command
Git's Filter Branch Command
 
Git Graphs, Hashes, and Compression, Oh My
Git Graphs, Hashes, and Compression, Oh MyGit Graphs, Hashes, and Compression, Oh My
Git Graphs, Hashes, and Compression, Oh My
 
Git and GitHub at the San Francisco JUG
 Git and GitHub at the San Francisco JUG Git and GitHub at the San Francisco JUG
Git and GitHub at the San Francisco JUG
 
Finding Things in Git
Finding Things in GitFinding Things in Git
Finding Things in Git
 
Git and GitHub for RallyOn
Git and GitHub for RallyOnGit and GitHub for RallyOn
Git and GitHub for RallyOn
 
Migrating from Subversion to Git and GitHub
Migrating from Subversion to Git and GitHubMigrating from Subversion to Git and GitHub
Migrating from Subversion to Git and GitHub
 
Git Notes and GitHub
Git Notes and GitHubGit Notes and GitHub
Git Notes and GitHub
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Build Lifecycle Craftsmanship for the Transylvania JUG
Build Lifecycle Craftsmanship for the Transylvania JUGBuild Lifecycle Craftsmanship for the Transylvania JUG
Build Lifecycle Craftsmanship for the Transylvania JUG
 
Git Going for the Transylvania JUG
Git Going for the Transylvania JUGGit Going for the Transylvania JUG
Git Going for the Transylvania JUG
 
Transylvania JUG Pre-Meeting Announcements
Transylvania JUG Pre-Meeting AnnouncementsTransylvania JUG Pre-Meeting Announcements
Transylvania JUG Pre-Meeting Announcements
 
Game Theory for Software Developers at the Boulder JUG
Game Theory for Software Developers at the Boulder JUGGame Theory for Software Developers at the Boulder JUG
Game Theory for Software Developers at the Boulder JUG
 
Cascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUGCascading Through Hadoop for the Boulder JUG
Cascading Through Hadoop for the Boulder JUG
 
JQuery Mobile
JQuery MobileJQuery Mobile
JQuery Mobile
 
R Data Analysis Software
R Data Analysis SoftwareR Data Analysis Software
R Data Analysis Software
 
Please, Stop Using Git
Please, Stop Using GitPlease, Stop Using Git
Please, Stop Using Git
 
Dr. Strangedev
Dr. StrangedevDr. Strangedev
Dr. Strangedev
 
Jenkins for One
Jenkins for OneJenkins for One
Jenkins for One
 
Lean Fluffy Startups
Lean Fluffy StartupsLean Fluffy Startups
Lean Fluffy Startups
 

Dernier

Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxDhatriParmar
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17Celine George
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleCeline George
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 

Dernier (20)

Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptxMan or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
Man or Manufactured_ Redefining Humanity Through Biopunk Narratives.pptx
 
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of EngineeringFaculty Profile prashantha K EEE dept Sri Sairam college of Engineering
Faculty Profile prashantha K EEE dept Sri Sairam college of Engineering
 
How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17How to Fix XML SyntaxError in Odoo the 17
How to Fix XML SyntaxError in Odoo the 17
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
Multi Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP ModuleMulti Domain Alias In the Odoo 17 ERP Module
Multi Domain Alias In the Odoo 17 ERP Module
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 

Getting started with Git

  • 1. Git going DVCS with n bending mental spoo minutes of 90 ode control ia source c v 1 by Matthew McCullough of Ambient Ideas, LLC
  • 2. Git -noun sant or unplea Slang. an British ” per son emptible cont ionar y rd English Dict -Oxfo 2
  • 3.
  • 4.
  • 5. astard, and otistical b “ I'm an eg projects all my I name yself. Fi rst Linux, after m git. ” now us Torvalds -Lin
  • 6.
  • 8. Clear Source Case Safe CVS PVCS RCS Folders
  • 9. Subversion BitKeeper Perforce Clear Source Case Safe CVS PVCS RCS Folders
  • 10. darcs Mercurial Bazaar Subversion BitKeeper Perforce Clear Source Case Safe CVS PVCS RCS Folders
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 28.
  • 29. 18
  • 30. 19
  • 31. Global Git Settings git config --global user.name quot;Hal Smithquot; 20
  • 32. Global Git Settings git config --global user.name quot;Hal Smithquot; git config --global user.email quot;hal@bnl.comquot; 20
  • 33. Global Git Settings git config --global user.name quot;Hal Smithquot; git config --global user.email quot;hal@bnl.comquot; ues val ent urr tc tpu Ou git config --list 20
  • 34. Creating a Repo mkdir myproj.git 21
  • 35. Creating a Repo mkdir myproj.git cd myproj.git 21
  • 36. Creating a Repo mkdir myproj.git cd myproj.git lks! t fo ’s i hat git init T 21
  • 37. 22
  • 38. 22
  • 39. Who’s Got Git? 23
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46. Hashes and Integrity 28
  • 47. SHA-1 Hash Index vs. Hash ‣ Centralized VCS uses DB auto-increment index. ‣ Git uses SHA-1 hash. ‣ Hash for the sake of integrity. Hashable Objects ‣ Blob ‣ Tree ‣ Commit ‣ Tag 29
  • 48. SHA-1 Hash Index vs. Hash ‣ Centralized VCS uses DB auto-increment index. ‣ Git uses SHA-1 hash. ‣ Hash for the sake of integrity. Hashable Objects ght hou It ere ‣ Blob es w ash h ‣ Tree for rds? ‣ Commit swo pas ‣ Tag 29
  • 53.
  • 54. alized entr C Alice Bob
  • 55. alized entr C Alice Bob 1 = okay.htm
  • 56. alized entr C Alice Bob 1 = okay.htm 2 = fine.htm
  • 57. alized entr C Alice Bob 1 = okay.htm 2 = fine.htm Sync
  • 58. alized entr C Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm 2 = fine.htm Sync
  • 59. alized entr C Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm 2 = fine.htm Sync 3 = good.htm
  • 60. alized entr C Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm 2 = fine.htm Sync 3 = good.htm 3 = great.htm
  • 61. alized entr C Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm 2 = fine.htm Sync 3 = good.htm Sync 3 = great.htm
  • 62. alized entr C Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm 2 = fine.htm Sync 4 = good.htm 3 = good.htm Sync 3 = great.htm 4 = great.htm
  • 63. alized entr C Alice Bob 1 = okay.htm 1 = okay.htm 2 = fine.htm 2 = fine.htm Sync ERROR 4 = good.htm 3 = good.htm ERROR Sync 3 = great.htm 4 = great.htm
  • 64.
  • 66. Distributed Alice Bob a233b76 = okay.htm
  • 67. Distributed Alice Bob a233b76 = okay.htm d234ab1 = fine.htm
  • 68. Distributed Alice Bob a233b76 = okay.htm d234ab1 = fine.htm Sync
  • 69. Distributed Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm d234ab1 = fine.htm Sync
  • 70. Distributed Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm d234ab1 = fine.htm Sync f90b12c = good.htm
  • 71. Distributed Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm d234ab1 = fine.htm Sync f90b12c = good.htm ae42ba0 = great.htm
  • 72. Distributed Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm d234ab1 = fine.htm Sync f90b12c = good.htm Sync ae42ba0 = great.htm
  • 73. Distributed Alice Bob a233b76 = okay.htm a233b76 = okay.htm d234ab1 = fine.htm d234ab1 = fine.htm Sync f90b12c = good.htm f90b12c = good.htm Sync ae42ba0 = great.htm ae42ba0 = great.htm
  • 74. Hash Benefits Integrity ‣ Identifies damaged repos. ‣ Prevents modification of published history. ‣ Unique to file size and contents. Tags ‣ Cryptographically sign tags by GPG/email. Independence ‣ Separation from sequence # of checkin. 35
  • 76. Remote is like a special Stash Repo Index Working
  • 77. Remote is like a special Stash Repo Index Working
  • 78. Remote is like a special Stash Repo git clone Index Working
  • 79. Remote is like a special Stash Repo git clone git checkout Index Working
  • 80. Remote is like a special Stash Repo git clone git checkout edit some files Index Working
  • 81. Remote is like a special Stash Repo git clone git checkout edit some files git stash Index Working
  • 82. Remote is like a special Stash Repo git clone git checkout edit some files git stash edit some files Index Working
  • 83. Remote is like a special Stash Repo git clone git checkout edit some files git stash edit some files Index git stash apply Working
  • 84. Remote is like a special Stash Repo git clone git checkout edit some files git stash edit some files Index git stash apply Working git add
  • 85. Remote is like a special Stash Repo git clone git checkout edit some files git stash edit some files Index git stash apply Working git add git commit
  • 86. Remote is like a special Stash Repo git clone git checkout edit some files git stash edit some files Index git stash apply Working git add git commit git push
  • 87. Remote is like a special Stash Repo git clone git checkout edit some files git stash edit some files Index git stash apply Working git add git commit git push
  • 88. repo uild B git clone git://somedomain/myproj.git cd myproj.git 38
  • 89. repo uild B git clone git://somedomain/myproj.git cd myproj.git dex te in pda U git checkout master 38
  • 90. repo uild B git clone git://somedomain/myproj.git cd myproj.git dex te in pda U git checkout master king echo ‘//Comments’ >> ClassOne.java or dit w echo ‘//Thoughts’ >> ClassTwo.java E 38
  • 91. repo uild B git clone git://somedomain/myproj.git cd myproj.git dex te in pda U git checkout master king echo ‘//Comments’ >> ClassOne.java or dit w echo ‘//Thoughts’ >> ClassTwo.java E ndex to i Add epo git add ClassOne.java to r ave comments’ S git commit -m’Added 38
  • 92. repo uild B git clone git://somedomain/myproj.git cd myproj.git dex te in pda U git checkout master king echo ‘//Comments’ >> ClassOne.java or dit w echo ‘//Thoughts’ >> ClassTwo.java E ndex to i Add epo git add ClassOne.java to r ave commit -m’Added comments’ S git ash st h to stash Pus git 38
  • 93. Single Stage Thinking Subversion svn commit ‣ ‣ Adds everything modified. ‣ Must list if you want specific files. ‣ What if you check in your password? 39
  • 94. $ echo //password >> Matt1.java $ echo //password >> Matt2.java 40
  • 95. $ echo //password >> Matt1.java $ echo //password >> Matt2.java $ svn status M Matt1.java M Matt2.java 40
  • 96. $ echo //password >> Matt1.java $ echo //password >> Matt2.java $ svn status M Matt1.java M Matt2.java $ svn commit -m'Matts checkin' Adding Matt1.java Adding Matt2.java Transmitting file data . Committed revision 2. 40
  • 97. Three Stage Thinking Git git add ‣ git commit ‣ git push ‣ ‣ Commits only what is added to the index. ‣ Opportunity to change history locally. ‣ Selectively share with other repos. 41
  • 98. $ echo //SECRETPASSWORD >> mattfile1.java $ echo //NewText2 >> mattfile2.java 42
  • 99. $ echo //SECRETPASSWORD >> mattfile1.java $ echo //NewText2 >> mattfile2.java $ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt 42
  • 100. $ echo //SECRETPASSWORD >> mattfile1.java $ echo //NewText2 >> mattfile2.java $ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt dex o in int Put $ git add mattfile1.txt 42
  • 101. $ echo //SECRETPASSWORD >> mattfile1.java $ echo //NewText2 >> mattfile2.java $ git status # On branch master # Changed but not updated: # modified: mattfile1.txt # modified: mattfile2.txt dex o in int Put $ git add mattfile1.txt epo to r ave S $ git commit -m'Matts pw checkin' [master]: created ddcdf18: quot;Matts changesquot; 1 files changed, 1 insertions(+), 0 deletions(-) 42
  • 102. #$%^&! I just committed my password! 43
  • 103. Change History $ git reset --hard HEAD^ HEAD is now at 9de4cd3 First checkin $ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough <matthewm@ambientideas.com> Date: Wed Mar 4 23:09:17 2009 -0700 First checkin 44
  • 104. Change History mit com the way wa hro T $ git reset --hard HEAD^ HEAD is now at 9de4cd3 First checkin $ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough <matthewm@ambientideas.com> Date: Wed Mar 4 23:09:17 2009 -0700 First checkin 44
  • 105. Change History mit com the way wa hro T $ git reset --hard HEAD^ HEAD is now at 9de4cd3 First checkin $ git log commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993 Author: Matthew McCullough <matthewm@ambientideas.com> Date: Wed Mar 4 23:09:17 2009 -0700 First checkin 44
  • 107. Directed Acyclic Graph a32 2e2 8b3 4e8
  • 108. Directed Acyclic Graph Ann’s Feature a32 5fa 2e2 8b3 4e8
  • 109. Directed Acyclic Graph Ann’s Feature a32 5fa 2e2 8b3 4e8
  • 110. Directed Acyclic Graph Ann’s Feature a32 5fa Tim’s Feature 2e2 d19 8b3 4e8
  • 111. Directed Acyclic Graph Ann’s Feature a32 5fa Tim’s Feature 2e2 d19 Linus’ rewrite of Tim’s feature 8b3 e69 4e8
  • 112. Directed Acyclic Graph Ann’s Feature a32 5fa Tim’s Feature 2e2 d19 Linus’ rewrite of Tim’s feature 8b3 e69 4e8
  • 114. Offline Anything Checkin 48
  • 115. Offline Anything Checkin Add Branch List change log Grep history Rewrite history Stash Merge Label Remove 48
  • 116. Offline Anything Checkin Add Branch List change log Grep history Rewrite history Stash Merge Label Remove practically everything but push 48
  • 117. Offline Anything Checkin Add Branch List change log Grep history Rewrite history Stash Merge Label Remove practically everything but push 48
  • 118.
  • 119. Hooray! Another checkin to my latest OSS project!
  • 120. Hooray! Another checkin to my latest OSS project! I think I liked subversion better...
  • 124. Repo Blessed Dictatorship
  • 125. Repo Blessed Dictatorship
  • 126. Repo Blessed Dictatorship
  • 127. Repo Blessed Dictatorship
  • 128. Repo Blessed Dictatorship
  • 129. Certified Integration Managed Development Repo Repo
  • 130. Certified Integration Managed Development Repo Repo
  • 131. Certified Integration Managed Development Repo Repo
  • 132. Certified Integration Managed Development Repo Repo
  • 133. Mirror Mirror Certified Development Repo Repo Mirrored
  • 134. Mirror Mirror Certified Development Repo Repo Mirrored
  • 135. Mirror Mirror Certified Development Repo Repo Mirrored
  • 136. Mirror Mirror Certified Development Repo Repo Mirrored
  • 137. Mirror Mirror Certified Development Repo Repo Mirrored
  • 138. ☚ Private Public ☛ GitHub Custom + Public Contrib
  • 139. ☚ Private Public ☛ GitHub Custom + Public Contrib
  • 140. ☚ Private Public ☛ Customized GitHub Custom + Public Contrib
  • 141. ☚ Private Public ☛ Customized GitHub Custom + Public Contrib
  • 142. ☚ Private Public ☛ Customized GitHub Custom + Public Contrib
  • 144. Init Add Status Diff Branch (Cold/Hot) git hg bzr git hg bzr git hg bzr git hg bzr Tag Log Commit (Lg) Commit (Sm) git c git h hg c hg h bzr c bzr h git hg bzr git hg bzr git hg bzr git hg bzr data from http://whygitisbetterthanx.com/#git-is-fast
  • 146. Serving It Up Network ‣ git instaweb. Built in, read-only, HTTP. ‣ git daemon. Custom socket language. ‣ gitosis. Easy permissions control. ‣ github. Open source & private repos. ‣ ssh. OS controlled permissions. 59
  • 147. 60
  • 148. 61
  • 149. Serving It Up Filesystem ‣ Local folders. Yes, they can be “remotes.” ‣ Mapped network drives. Just like folders. 62
  • 150. on aem it d g git clone git://somehost.org/myproj.git 63
  • 151. on aem it d g git clone git://somehost.org/myproj.git SSH git clone mccm06@somehost.org:myproj.git 63
  • 152. on aem it d g git clone git://somehost.org/myproj.git SSH git clone mccm06@somehost.org:myproj.git TTP H git clone http://somehost.org/myproj.git 63
  • 153. on aem it d g git clone git://somehost.org/myproj.git SSH git clone mccm06@somehost.org:myproj.git TTP H git clone http://somehost.org/myproj.git tem sys File git clone ~/work/myproj.git 63
  • 154. on aem it d g git clone git://somehost.org/myproj.git SSH git clone mccm06@somehost.org:myproj.git TTP H git clone http://somehost.org/myproj.git tem sys File git clone ~/work/myproj.git rive rk d two Ne git clone z:someservermyproj.git 63
  • 156. Serversion git svn clone http://unfurl.com/trunk git svn dcommit ‣ First class compatibility. ‣ Round trip support. ‣ Git commits = svn commits. 65
  • 157. 66
  • 163.
  • 165. Cherry Pick ❻ ‣git cherry-pick a5b2ee 73
  • 166. Cherry Pick ❻ ‣git cherry-pick a5b2ee ‣Merge in just one commit. 73
  • 167. Cherry Pick ❻ ‣git cherry-pick a5b2ee ‣Merge in just one commit. ‣When you want a nugget, not a branchload. 73
  • 168. Gives Credit ❺ ‣Tracks who authors a change. 74
  • 169. Gives Credit ❺ ‣Tracks who authors a change. ‣“Author” even survives passing through reviewers. 74
  • 170. Gives Credit ❺ ‣Tracks who authors a change. ‣“Author” even survives passing through reviewers. ‣“Author” survives all merges. 74
  • 171. Gives Credit ❺ ‣Tracks who authors a change. ‣“Author” even survives passing through reviewers. ‣“Author” survives all merges. ‣Additionally tracks who committed a change. 74
  • 172. Bisect Bugs ❹ ‣git bisect run mvn test 75
  • 173. Bisect Bugs ❹ ‣git bisect run mvn test ‣Binary-search for bug. 75
  • 174. Bisect Bugs ❹ ‣git bisect run mvn test ‣Binary-search for bug. ‣Manual or automated modes. 75
  • 175. Bisect Bugs ❹ ‣git bisect run mvn test ‣Binary-search for bug. ‣Manual or automated modes. ‣Yak cruelty-prevention. 75
  • 176. Squash Verbosity ❸ ‣git merge --squash mybranch 76
  • 177. Squash Verbosity ❸ ‣git merge --squash mybranch ‣Reduce all your micro-checkins to block commits. 76
  • 178. Squash Verbosity ❸ ‣git merge --squash mybranch ‣Reduce all your micro-checkins to block commits. ‣Make mistakes, revise, checkin without hesitation. 76
  • 179. Squash Verbosity ❸ ‣git merge --squash mybranch ‣Reduce all your micro-checkins to block commits. ‣Make mistakes, revise, checkin without hesitation. ‣Great for SVN compatibility. 76
  • 180. Search History ❷ ‣git grep SomeText HEAD^^^ 77
  • 181. Search History ❷ ‣git grep SomeText HEAD^^^ ‣Search in file history without checkout. 77
  • 182. Search History ❷ ‣git grep SomeText HEAD^^^ ‣Search in file history without checkout. ‣Greps contents. 77
  • 183. Rebase ❶ ‣git rebase master 78
  • 184. Rebase ❶ ‣git rebase master ‣Reposition your feature branch’s start point. 78
  • 185. Rebase ❶ ‣git rebase master ‣Reposition your feature branch’s start point. ‣Makes for simpler merge graphs. 78
  • 186. Rebase ❶ ‣git rebase master ‣Reposition your feature branch’s start point. ‣Makes for simpler merge graphs. ‣Sustains feature-branch work clarity. 78
  • 187. 79
  • 189. tthew Ma Twitter @matthewmccull Blog http://www.ambientideas.com/blog sidebar has all my social media links Email matthewm@ambientideas.com GitHub http://github.com/matthewmccullough 81
  • 190. Resources Git Homepage http://git-scm.com Directed Acrylic Graph http://en.wikipedia.org/wiki/Directed_acyclic_graph Git for Computer Scientists http://eagain.net/articles/git-for-computer-scientists/ Git Treeish http://book.git-scm.com/4_git_treeishes.html 82
  • 191. Resources Git Docs http://www.kernel.org/pub/software/scm/git/docs/ Git Magic eBook http://www-cs-students.stanford.edu/~blynn/gitmagic/book.pdf Linus Torvald’s Git talk at Google http://www.youtube.com/watch?v=4XpnKHJAok8 CygWin http://www.cygwin.com 83
  • 192. Resources MSysGit http://code.google.com/p/msysgit Git Cheetah http://code.google.com/p/msysgit/wiki/GitCheetah Matthew’s Git Bookmarks http://delicious.com/matthew.mccullough/git Matthew’s Bash Prompt http://gist.github.com/47267 84
  • 193. Image Credits ‣ http://www.ambientideasphotography.com ‣ http://flickr.com/photos/lenore-m/2903856664/ ‣ http://en.wikipedia.org/wiki/Git_(software) ‣ http://flickr.com/photos/karenhorton/1583513014/ ‣ http://flickr.com/photos/mashdnart/2545782407/ ‣ http://commons.wikimedia.org/wiki/ File:Small_Boy_nuclear_test_1962.jpg ‣ http://www.flickr.com/photos/knmurphy/2506896257/ ‣ http://www.flickr.com/photos/albyspace/1022035568/ ‣ http://flickr.com/photos/michaelhays/3070238360/ ‣ http://flickr.com/photos/d_vdm/509996632/ 85