SlideShare a Scribd company logo
1 of 454
Download to read offline
Git 101
Scott Chacon
Introduction
Me
Scott Chacon
git-scm.com
http://progit.org
schacon@gmail.com
@chacon
  twitter
</me>
What is Git?
Git is an open source,
distributed version control
system designed for speed
        and efficiency
version control
mercurial (hg)

            bazaar

       subversion (svn)


version control
concurrent version system (cvs)

           perforce

       visual source safe
SoS
        mercurial (hg)

            bazaar

       subversion (svn)


version control
concurrent version system (cvs)

           perforce

       visual source safe
SoS
        mercurial (hg)      “not bad”

            bazaar

       subversion (svn)


version control
concurrent version system (cvs)

           perforce

       visual source safe
SoS
        mercurial (hg)

            bazaar

       subversion (svn)


version control
concurrent version system (cvs)

           perforce

       visual source safe “kill self”
git           mercurial (hg)

                  bazaar

             subversion (svn)


      version control
      concurrent version system (cvs)

                 perforce

             visual source safe
Git is an open source,
distributed version control
system designed for speed
       and efficiency
git-scm.com
Git is an open source,
distributed version control
 system designed for speed
        and efficiency
Fully Distributed
(almost) everything is local
which means

   everything is fast

every clone is a backup

     work offline
No Network Needed
         Performing a diff
        Viewing file history
       Committing changes
         Merging branches
 Obtaining other revisions of a file
        Switching branches
Git is an open source,
distributed version control
  system designed for
 speed and efficiency
Immutable
(almost) never removes data
Snapshots, not Patches
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
              



                        
 delta
storage
                             



                            




                          




snapshot                   

 storage
                             



                           
Basic Git
First Steps
$ git config --global user.name “Scott Chacon”

$ git config --global user.email “schacon@gmail.com”
Getting a Repo
Create One
git init
$   touch hello_world.rb
$   git init
$   git add .
$   git commit -m ‘first commit’
$   touch hello_world.rb
$   git init
$   git add .
$   git commit -m ‘first commit’
$ tree -a
.
|-- .git
|   |-- HEAD
|   |-- branches
|   |-- config
|   |-- description
|   |-- hooks
|   |    |-- post-commit.sample
|   |    |-- post-receive.sample
|   |    |-- ...
|   |    |-- pre-rebase.sample
|   |    `-- update.sample
|   |-- info
|   |    `-- exclude
|   |-- objects
|   |    |-- info
|   |    `-- pack
|   |-- refs
|   |    |-- heads
|   |    `-- tags
|   `-- remotes
`-- hello_world.rb

11 directories, 25 files
$ tree -a
.
|-- .git
|   |-- HEAD
|   |-- branches
|   |-- config
|   |-- description
|   |-- hooks
|   |    |-- post-commit.sample
|   |    |-- post-receive.sample
|   |    |-- ...
|   |    |-- pre-rebase.sample
|   |    `-- update.sample
|   |-- info
|   |    `-- exclude
|   |-- objects
|   |    |-- info
|   |    `-- pack
|   |-- refs
|   |    |-- heads
|   |    `-- tags
|   `-- remotes
`-- hello_world.rb

11 directories, 25 files
$ tree -a
.
|-- .git
|   |-- HEAD
|   |-- branches
|   |-- config
|   |-- description
|   |-- hooks
|   |    |-- post-commit.sample
|   |    |-- post-receive.sample
|   |    |-- ...
|   |    |-- pre-rebase.sample
|   |    `-- update.sample
|   |-- info
|   |    `-- exclude
|   |-- objects
|   |    |-- info
|   |    `-- pack
|   |-- refs
|   |    |-- heads
|   |    `-- tags
|   `-- remotes
`-- hello_world.rb

11 directories, 25 files
$   touch hello_world.rb
$   git init
$   git add .
$   git commit -m ‘first commit’
$   touch hello_world.rb
$   git init
$   git add .
$   git commit -m ‘first commit’
$ tree -a
.
|-- .git
|   |-- COMMIT_EDITMSG
|   |-- HEAD
|   |-- branches
|   |-- config
|   |-- description
|   |-- hooks
|   |    |-- applypatch-msg.sample
|   |    `-- update.sample
|   |-- index
|   |-- info
|   |    `-- exclude
|   |-- logs
|   |    |-- HEAD
|   |    `-- refs
|   |        `-- heads
|   |             `-- master
|   |-- objects
|   |    |-- 32/09658ac8d80bc9726d3a33d77e3dfc5fe6035e
|   |    |-- 53/9cd7886a627841d525a78d45cbc6396be20b41
|   |    |-- e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|   |    |-- info
|   |    `-- pack
|   |-- refs
|   |    |-- heads
|   |    |   `-- master
|   |    `-- tags
|   `-- remotes
`-- hello_world.rb

17 directories, 33 files
$ tree -a
.
|-- .git
|   |-- COMMIT_EDITMSG
|   |-- HEAD
|   |-- branches
|   |-- config
|   |-- description
|   |-- hooks
|   |    |-- applypatch-msg.sample
|   |    `-- update.sample
|   |-- index
|   |-- info
|   |    `-- exclude
|   |-- logs
|   |    |-- HEAD
|   |    `-- refs
|   |        `-- heads
|   |             `-- master
|   |-- objects
|   |    |-- 32/09658ac8d80bc9726d3a33d77e3dfc5fe6035e
|   |    |-- 53/9cd7886a627841d525a78d45cbc6396be20b41
|   |    |-- e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|   |    |-- info
|   |    `-- pack
|   |-- refs
|   |    |-- heads
|   |    |   `-- master
|   |    `-- tags
|   `-- remotes
`-- hello_world.rb

17 directories, 33 files
$ tree -a
.
|-- .git
|   |-- COMMIT_EDITMSG
|   |-- HEAD
|   |-- branches
|   |-- config
|   |-- description
|   |-- hooks
|   |    |-- applypatch-msg.sample
|   |    `-- update.sample
|   |-- index
|   |-- info
|   |    `-- exclude
|   |-- logs
|   |    |-- HEAD
|   |    `-- refs
|   |        `-- heads
|   |             `-- master
|   |-- objects
|   |    |-- 32/09658ac8d80bc9726d3a33d77e3dfc5fe6035e
|   |    |-- 53/9cd7886a627841d525a78d45cbc6396be20b41
|   |    |-- e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391
|   |    |-- info
|   |    `-- pack
|   |-- refs
|   |    |-- heads
|   |    |   `-- master
|   |    `-- tags
|   `-- remotes
`-- hello_world.rb

17 directories, 33 files
Clone One
git clone
$ git clone git://github.com/schacon/ticgit.git
Initialized empty Git repository in /private/tmp/ticgit/.git/
remote: Counting objects: 591, done.
remote: Compressing objects: 100% (267/267), done.
remote: Total 591 (delta 253), reused 587 (delta 252)
Receiving objects: 100% (591/591), 73.05 KiB, done.
Resolving deltas: 100% (253/253), done.
$ cd ticgit/
$ ls
LICENSE! ! Rakefile! examples! note! ! ticgit.gemspec
README!
      ! bin! lib! spec
             !     !
$
$ git clone git://github.com/schacon/ticgit.git
Initialized empty Git repository in /private/tmp/ticgit/.git/
remote: Counting objects: 591, done.
remote: Compressing objects: 100% (267/267), done.
remote: Total 591 (delta 253), reused 587 (delta 252)
Receiving objects: 100% (591/591), 73.05 KiB, done.
Resolving deltas: 100% (253/253), done.
$ cd ticgit/
$ ls
LICENSE! ! Rakefile! examples! note! ! ticgit.gemspec
README!
      ! bin! lib! spec
             !     !
$
$ git clone git://github.com/schacon/ticgit.git
Initialized empty Git repository in /private/tmp/ticgit/.git/
remote: Counting objects: 591, done.
remote: Compressing objects: 100% (267/267), done.
remote: Total 591 (delta 253), reused 587 (delta 252)
Receiving objects: 100% (591/591), 73.05 KiB, done.
Resolving deltas: 100% (253/253), done.
$ cd ticgit/
$ ls
LICENSE! ! Rakefile! examples! note! ! ticgit.gemspec
README!
      ! bin! lib! spec
             !     !
$
$ git clone git://github.com/schacon/ticgit.git
Initialized empty Git repository in /private/tmp/ticgit/.git/
remote: Counting objects: 591, done.
remote: Compressing objects: 100% (267/267), done.
remote: Total 591 (delta 253), reused 587 (delta 252)
Receiving objects: 100% (591/591), 73.05 KiB, done.
Resolving deltas: 100% (253/253), done.
$ cd ticgit/
$ ls
.git LICENSE! ! Rakefile! examples! note! !
ticgit.gemspec     README!! bin!!     lib!! spec
$
A Basic Workflow
A Basic Workflow
     Edit files
 Stage the changes
Review your changes
Commit the changes
working directory

git add
            index

                       git commit
          repository
a working copy
      working directory
                           of your project
git add
            index

                       git commit
          repository
working directory

         git add
                       index

                                  git commit

object database      repository
working directory

git add
            index          “staging”
                       git commit
          repository
A Basic Workflow
     Edit files
 Stage the changes
Review your changes
Commit the changes
$ find .
./app.yaml
./index.yaml
./main.py
$ vim main.py
#!/usr/bin/env python
import wsgiref.handlers
from google.appengine.ext import webapp

class MainHandler(webapp.RequestHandler):

  def get(self):
    self.response.out.write('Hello world!')

def main():
  application = webapp.WSGIApplication([('/', MainHandler)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
  main()
~
~
"main.py" 16L, 402C
$ vim main.py
#!/usr/bin/env python
import wsgiref.handlers
from google.appengine.ext import webapp

# this program prints out ‘hello world’

class MainHandler(webapp.RequestHandler):

  def get(self):
    self.response.out.write('Hello world!')

def main():
  application = webapp.WSGIApplication([('/', MainHandler)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
  main()
~
~
"main.py" 16L, 402C
$ git status
$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what
#
#	modified:   main.py
#
no changes added to commit (use "git add" an
$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what
#
#	modified:   main.py
#
no changes added to commit (use "git add" an
$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what
#
#	modified:   main.py
#
no changes added to commit (use "git add" an
$ git status
# On branch master
# Changed but not STAGED
                   updated:
#   (use "git add <file>..." to update what
#
#	modified:   main.py
#
no changes added to commit (use "git add" an
A Basic Workflow
     Edit files
 Stage the changes
Review your changes
Commit the changes
git add
working directory

git add
            index

                       git commit
          repository
working directory

git add
            index

                       git commit
          repository
$ git add main.py
$ git status
# On branch master
# Changes to be committed:
#    (use "git reset HEAD <file>.
#
#	modified:   main.py
#
$ git add main.py
$ git status
# On branch master
# Changes to be committed:
#    (use "git reset HEAD <file>.
#
#	modified:   main.py
#
$ git add main.py
$ git status
# On branch master
# Changes to be committed:
           THAT ARE STAGED
#    (use "git reset HEAD <file>.
#
#	modified:   main.py
#
$ vim app.yaml
application: chacon
version: 1
runtime: python
api_version: 1

handlers:
- url: .*
  script: main.py
~
~
~
"app.yaml" 8L, 101C
$ vim app.yaml
application: chacon
version: 1
runtime: python
api_version: 1

handlers:
- url: .*
  script: main.py
~
~
~
"app.yaml" 8L, 101C
$ vim app.yaml
application: chacon
version: 2
runtime: python
api_version: 1

handlers:
- url: .*
  script: main.py
~
~
~
"app.yaml" 8L, 101C
$ git status
# On branch master
# Changes to be committed:
#    (use "git reset HEAD <file>..." to unstage)
#
#	 modified:   main.py
#
# Changed but not updated:
#    (use "git add <file>..." to update what will be com
#
#	 modified:   app.yaml
#
$ vim main.py
#!/usr/bin/env python
import wsgiref.handlers
from google.appengine.ext import webapp

# this program prints out ‘hello world’

class MainHandler(webapp.RequestHandler):

  def get(self):
    self.response.out.write('Hello world!')

def main():
  application = webapp.WSGIApplication([('/', MainHandler)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
  main()
~
~
"main.py" 16L, 402C
$ vim main.py
#!/usr/bin/env python
import wsgiref.handlers
from google.appengine.ext import webapp

# this program prints out ‘hello world’

class MainHandler(webapp.RequestHandler):

  def get(self):
    self.response.out.write('Hola world!')

def main():
  application = webapp.WSGIApplication([('/', MainHandler)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
  main()
~
~
"main.py" 16L, 402C
$ vim main.py
#!/usr/bin/env python
import wsgiref.handlers
from google.appengine.ext import webapp

# this program prints out ‘hello world’

class MainHandler(webapp.RequestHandler):

  def get(self):
    self.response.out.write('Hola Mundo!')

def main():
  application = webapp.WSGIApplication([('/', MainHandler)],
                                       debug=True)
  wsgiref.handlers.CGIHandler().run(application)

if __name__ == '__main__':
  main()
~
~
"main.py" 16L, 402C
$ git status
# On branch master
# Changes to be committed:
#    (use "git reset HEAD <file>..." to unstage)
#
#	 modified:   main.py
#
# Changed but not updated:
#    (use "git add <file>..." to update what will be com
#
#	 modified:   app.yaml
#	 modified:   main.py
#
$ git status
         # On branch master
         # Changes to be committed:
Staged   #    (use "git reset HEAD <file>..." to unstage)
         #
         #	 modified:    main.py
         #
         # Changed but not updated:
         #    (use "git add <file>..." to update what will be com
         #
         #	 modified:    app.yaml
         #	 modified:    main.py
         #
$ git status
           # On branch master
           # Changes to be committed:
           #    (use "git reset HEAD <file>..." to unstage)
           #
           #	 modified:    main.py
           #
           # Changed but not updated:
Unstaged   #
           #
                (use "git add <file>..." to update what will be com

           #	 modified:    app.yaml
           #	 modified:    main.py
           #
$ git status
# On branch master
# Changes to be committed:
#    (use "git reset HEAD <file>..." to unstage)
#
#	 modified:    main.py
#
# Changed but not updated:
#    (use "git add <file>..." to update what will be com
#
#	 modified:    app.yaml
#	 modified:    main.py
#
Staged                             In Working Directory
#!/usr/bin/env python                         #!/usr/bin/env python
import wsgiref.handlers                       import wsgiref.handlers
from google.appengine.ext import webapp       from google.appengine.ext import webapp

# this program prints out ‘hello world’       # this program prints out ‘hello world’

class MainHandler(webapp.RequestHandler):     class MainHandler(webapp.RequestHandler):

  def get(self):                                def get(self):
    self.response.out.write('Hello World!')       self.response.out.write('Hola Mundo!')

def main():                                   def main():
  application = webapp.WSGIApplication          application = webapp.WSGIApplication
([('/'                                        ([('/'
debug=True)                                   debug=True)
  wsgiref.handlers.CGIHandler().run             wsgiref.handlers.CGIHandler().run
(applicat                                     (applicat

if __name__ == '__main__':                    if __name__ == '__main__':
  main()                                        main()
Staged                             In Working Directory
#!/usr/bin/env python                         #!/usr/bin/env python
import wsgiref.handlers                       import wsgiref.handlers
from google.appengine.ext import webapp       from google.appengine.ext import webapp

# this program prints out ‘hello world’       # this program prints out ‘hello world’

class MainHandler(webapp.RequestHandler):     class MainHandler(webapp.RequestHandler):

  def get(self):                                def get(self):
    self.response.out.write('Hello World!')       self.response.out.write('Hola Mundo!')

def main():                                   def main():
  application = webapp.WSGIApplication          application = webapp.WSGIApplication
([('/'                                        ([('/'
debug=True)                                   debug=True)
  wsgiref.handlers.CGIHandler().run             wsgiref.handlers.CGIHandler().run
(applicat                                     (applicat

if __name__ == '__main__':                    if __name__ == '__main__':
  main()                                        main()
You have to stage a file
   after you edit it
You have to stage a file
  after you edit it
You have to stage a file
  after you edit it
$ git add app.yaml main.py
$ git status
# On branch master
# Changes to be committed:
#    (use "git reset HEAD <file>..." to unstage)
#
#	 modified:   app.yaml
#	 modified:   main.py
#
A Basic Workflow
     Edit files
 Stage the changes
Review your changes
Commit the changes
git commit
working directory

git add
            index

                       git commit
          repository
working directory

git add
            index

                       git commit
          repository
$ git commit

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   app.yaml
#       modified:   main.py
#
~
~
~
~
".git/COMMIT_EDITMSG" 10L, 279C
$ git commit

descriptive commit message
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   app.yaml
#       modified:   main.py
#
~
~
~
~
".git/COMMIT_EDITMSG" 10L, 279C
$ git commit

descriptive commit message
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   app.yaml
#       modified:   main.py
#
~
~
~
~
".git/COMMIT_EDITMSG" 10L, 279C
$ git commit
Created commit 77d3001: descriptive commit message
 2 files changed, 4 insertions(+), 2 deletions(-)
A Basic Workflow
     Edit files        vim / emacs / etc
 Stage the changes      git add (file)
Review your changes     repo status
Commit the changes       git commit
A Basic Workflow
     Edit files        vim / emacs / etc
 Stage the changes      git add (file)
Review your changes     repo status
Commit the changes       git commit
A Basic Workflow
     Edit files        vim / emacs / etc
 Stage the changes      git add (file)
Review your changes     repo status
Commit the changes       git commit
A Basic Workflow
     Edit files        vim / emacs / etc
 Stage the changes      git add (file)
Review your changes       git status
Commit the changes       git commit
A Basic Workflow
     Edit files        vim / emacs / etc
 Stage the changes      git add (file)
Review your changes       git status
Commit the changes       git commit
A Basicer Workflow

    Edit files      vim / emacs / etc
Stage and Commit    git commit -a
What’s going on here?
$ git commit
Created commit 77d3001: descriptive commit message
 2 files changed, 4 insertions(+), 2 deletions(-)
$ git commit
Created commit 77d3001: descriptive commit message
 2 files changed, 4 insertions(+), 2 deletions(-)
77d3001
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
                  ae668..
               commit               size
                 tree         c4ec5
                parent        a149e
                author        Scott
               committer      Scott
               my commit message goes here
               and it is really, really cool
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
                   ae668..
                     commit        size
tree c4ec543b0322744e55c5efc9b6c4e449d398dbff
parent a149e2160b3f7573768cdc2fce24d0881f3577e1
                       tree    c4ec5
author Scott Chacon <schacon@gmail.com> 1223402504 -0700
committer Scott Chaconparent
                        <schacon@gmail.com> 1223402504 -0700
                               a149e
                      author   Scott
descriptive commit message
                     committer Scott
                     my commit message goes here
                     and it is really, really cool
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
                  ae668..
               commit               size
                 tree         c4ec5
                parent        a149e
                author        Scott
               committer      Scott
               my commit message goes here
               and it is really, really cool
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
                  ae668..
               commit                 size
                 tree           c4ec5
                parent          a149e
                author          Scott
               committer        Scott
               my commit message goes here
               and it is really, really cool




                         ./         c4e



                              app.yaml       3d5



                              index.yaml     1d3



                               main.py       03e
ae668..
                              commit                 size
commit               size
  tree         2de54
                                tree           c4ec5
 parent        38def           parent          a149e
 author        Scott
                               author          Scott
committer      Scott
this is the previous commit   committer        Scott
and I am very proud of it
                              my commit message goes here
                              and it is really, really cool




                                        ./         c4e



                                             app.yaml       3d5



                                             index.yaml     1d3



                                              main.py       03e
ae668..
                                 commit                 size
commit                    size
  tree            2de54
                                   tree           c4ec5
 parent           38def           parent          a149e
 author           Scott
                                  author          Scott
committer         Scott
this is the previous commit      committer        Scott
and I am very proud of it
                                 my commit message goes here
                                 and it is really, really cool


        ./         c4e



             app.yaml     3d5



             index.yaml   1d3              ./         c4e

              main.py     03e



                                                app.yaml       3d5



                                                index.yaml     1d3



                                                 main.py       03e
ae668..
                                                                                                   commit                 size
                                                                  commit                    size
commit                    size
                                 commit                    size
                                                                    tree            2de54
                                                                                                     tree           c4ec5
                                   tree            2fe65
  tree
 parent
 author
                  2fe65
                  90ecd           parent           90ecd           parent           38def           parent          a149e
                  Scott
                                  author           Scott
                                                                   author
                                                                                                    author
committer         Scott
                                 committer                                          Scott
this is the commit before that
and I'm not sure why
                                                   Scott
                                                                                                                    Scott
                                 this is the commit before that
                                 and I'm not sure why             committer         Scott
                                                                  this is the previous commit      committer        Scott
                                                                  and I am very proud of it
        ./         c4e



             app.yaml     3d5
                                                                                                   my commit message goes here
                                         ./         c4e

             index.yaml   1d3
                                                                                                   and it is really, really cool
                                              app.yaml     3d5
              main.py     03e




                                              index.yaml   1d3
                                                                          ./         c4e
                                               main.py     03e



                                                                               app.yaml     3d5



                                                                               index.yaml   1d3              ./         c4e

                                                                                main.py     03e



                                                                                                                  app.yaml       3d5



                                                                                                                  index.yaml     1d3



                                                                                                                   main.py       03e
ae668..
                                                                                                   commit                 size
                                                                  commit                    size
commit                    size
                                 commit                    size
                                                                    tree    2de54
                                                                                                     tree           c4ec5
                                   tree    2fe65
  tree
 parent
 author
             48e
                  2fe65
               90ecd              parent 38d
                                           90ecd                   parent a14
                                                                            38def                   parent        77d
                                                                                                                    a149e
                  Scott
                                  author   Scott
                                                                   author
                                                                                                    author
committer         Scott
                                 committer                                  Scott
this is the commit before that
and I'm not sure why
                                                   Scott
                                                                                                                    Scott
                                 this is the commit before that
                                 and I'm not sure why             committer         Scott
                                                                  this is the previous commit      committer        Scott
                                                                  and I am very proud of it
        ./         c4e



                          3d5
                                                                                                   my commit message goes here
                                                   32a
             app.yaml                               c4e
                                         ./

             index.yaml   1d3
                                                                                                   and it is really, really cool
                                              app.yaml     3d5
              main.py     03e




                                              index.yaml   5b1
                                                           1d3
                                                                                     c4e
                                                                          ./         f46
                                               main.py     03e



                                                                               app.yaml     23f
                                                                                            3d5



                                                                               index.yaml   30e
                                                                                            1d3              ./         c4e

                                                                                main.py     67e
                                                                                            03e



                                                                                                                  app.yaml       3d5



                                                                                                                  index.yaml     1d3



                                                                                                                   main.py       03e
                                                                                                                                 03e
Repository

5b1   32a   c36

1d3   f46   3d4

ffe   6fe   ae6

38d   23f   03e

254   30e   5b1

a14   67e   1d3

3d5   735   d23

c4e   c4e   48e

77d   de3   2d3
Repository

5b1   32a   c36

1d3   f46   3d4

ffe   6fe   ae6
                  git checkout ae635
38d   23f   03e

254   30e   5b1

a14   67e   1d3

3d5   735   d23

c4e   c4e   48e

77d   de3   2d3
Repository

5b1   32a   c36

1d3   f46   3d4

ffe   6fe   ae6
                  git checkout ae635
38d   23f   03e

254   30e   5b1

a14   67e   1d3

3d5   735   d23

c4e   c4e   48e

77d   de3   2d3
Repository             Index               Working Directory

5b1   32a   c36
                  ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6   ./Rakefile         1d3              Rakefile

38d   23f   03e
                  ./README          03e              README
254   30e   5b1

a14   67e   1d3
                  ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e   ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3
Repository             Index               Working Directory

5b1   32a   c36
                  ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6   ./Rakefile         1d3              Rakefile

38d   23f   03e
                  ./README          03e              README
254   30e   5b1

a14   67e   1d3
                  ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e   ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3
Repository             Index               Working Directory

5b1   32a   c36
                  ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6   ./Rakefile         1d3              Rakefile

38d   23f   03e
                  ./README          03e              README
254   30e   5b1

a14   67e   1d3
                  ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e   ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3
Repository             Index               Working Directory

5b1   32a   c36
                  ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6   ./Rakefile         1d3              Rakefile

38d   23f   03e
                  ./README          03e              README
254   30e   5b1

a14   67e   1d3
                  ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e   ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3
Repository             Index               Working Directory

5b1   32a   c36
                  ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6   ./Rakefile         1d3              Rakefile

38d   23f   03e
                  ./README          03e              README
254   30e   5b1

a14   67e   1d3
                  ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e   ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3




                                           git add
Repository             Index               Working Directory

5b1   32a   c36
                  ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6   ./Rakefile         1d3              Rakefile
                                     34f
38d   23f   03e
                  ./README          03e              README
254   30e   5b1

a14   67e   1d3
                  ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e   ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3




                                           git add
Repository               Index               Working Directory

5b1   32a   c36
                    ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6     ./Rakefile         1d3
                                      34f              Rakefile

38d   23f   03e
                    ./README          03e              README
254   30e   5b1

a14   67e   1d3
                    ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e     ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3

34f   3da   a08

ae9




                  git commit
Repository             Index               Working Directory

5b1   32a   c36
                  ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6   ./Rakefile         1d3
                                    34f              Rakefile

38d   23f   03e
                  ./README          03e              README
254   30e   5b1

a14   67e   1d3
                  ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e   ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3

34f   3da   a08

ae9
Repository             Index               Working Directory

5b1   32a   c36
                  ./                3d4         ./
1d3   f46   3d4

ffe   6fe   ae6   ./Rakefile         1d3
                                    34f              Rakefile

38d   23f   03e
                  ./README          03e              README
254   30e   5b1

a14   67e   1d3
                  ./lib/            c36                lib/
3d5   735   d23

c4e   c4e   48e   ./lib/simplegit.rb 5b1                  simplegit.rb

77d   de3   2d3

34f   3da   a08

ae9
object model
pointer to a       commit




                            }
 snapshot


                                C1
directory list      tree




file contents        blob
object model
pointer to a       commit




                            }
 snapshot


                                C1
directory list      tree




file contents        blob
ref




       commit                 commit                 commit




        tree                   tree                   tree



blob            tree   blob            tree   blob            tree



                blob
Branching and Merging
branches
branches
lightweight, movable
pointers to a commit



      branch



        C1
branching
git branch
git checkout
HEAD



     default
     master         experiment




C0     C1




               C2      C3
HEAD


 C4
      default
      master       experiment




C3
C0       C5
        C1




              C2
      experiment      C3




      git branch experiment
HEAD


 C4
      default
      master       experiment




C3
C0       C5
        C1




              C2
      experiment      C3




      git branch experiment
HEAD


 C4
      default
      master       experiment


                           $ git branch
C3
C0       C5
        C1                 * default
                             experiment

              C2
      experiment      C3
HEAD


 C4
      default
      master       experiment


                           $ git branch
C3
C0       C5
        C1                 * default
                             experiment

              C2
      experiment      C3
C4
       default
       master      experiment




C3
C0        C5
         C1




              C2
      experiment      C3


        HEAD




      git checkout experiment
T1          master
               default
               master              experiment


                                           git commit
    C0    C4 C1




2        C3              C5
                         C2           C3




                   experiment



                     HEAD
T1          master
               default
               master              experiment


                                           git commit
    C0    C4 C1




2        C3              C5
                         C2           C3




                   experiment



                     HEAD
T1          master
               default
               master              experiment


                                           git commit
    C0    C4 C1




2        C3              C5
                         C2           C3




                   experiment



                     HEAD
T1          master
           default
           master               experiment


                                         git commit
C1
 C0          C1        C4
                                         git commit

      C2              C3
                     C2            C5
                                   C3




                                experiment



                                  HEAD
HEAD


                           T1
           default
           master               git checkout default
                                        master
                                 experiment




C1
 C0          C1        C4




      C2              C3
                     C2             C5
                                    C3




                                 experiment
HEAD


                           T1
           default
           master               git checkout default
                                        master
                                 experiment




C1
 C0          C1        C4




      C2              C3
                     C2             C5
                                    C3




                                 experiment
git commit
            T1              T1
                            master       default
                                         master



                                           HEAD

C1
C0        C1     C4         C4




     C2         C3
               C2        C5
                         C3           C5




                      experiment   experiment
git commit
            T1              T1
                            master       default
                                         master



                                           HEAD

C1
C0        C1     C4         C4




     C2         C3
               C2        C5
                         C3           C5




                      experiment   experiment
git commit
            T1              T1
                            master       default
                                         master



                                           HEAD

C1
C0        C1     C4         C4




     C2         C3
               C2        C5
                         C3           C5




                      experiment   experiment
T1         default
                                          master




  C0        C1             C4




                 C2       C3           C5




git checkout experiment             experiment

       git commit
                                      HEAD
what is a branch, really?
$ find .git/refs
.git/refs
.git/refs/heads
.git/refs/heads/default
.git/refs/heads/experiment
$ find .git/refs
.git/refs
.git/refs/heads
.git/refs/heads/default
.git/refs/heads/experiment
$ find .git/refs
.git/refs
.git/refs/heads
.git/refs/heads/default
.git/refs/heads/experiment
$ find .git/refs
.git/refs
.git/refs/heads
.git/refs/heads/default
.git/refs/heads/experiment
$ cat .git/refs/heads/default
6370409dc9e38af91565082bdf93577ff555489e
$ find .git/refs
.git/refs
.git/refs/heads
.git/refs/heads/default
.git/refs/heads/experiment
$ cat .git/refs/heads/default
6370409dc9e38af91565082bdf93577ff555489e
$ cat .git/refs/heads/experiment
33ce13c2f0ed35775956f81191b01a644448dcfc
$ cat .git/HEAD
ref: refs/heads/experiment
$ cat .git/HEAD
ref: refs/heads/experiment
$ cat .git/HEAD
ref: refs/heads/experiment
merging
git merge
T1         default
                               master




C0   C1         C4




          C2   C3           C5




                         experiment



                           HEAD
HEAD



                            T1         default
                                       master




C0        C1            C4




                C2     C3           C5




git checkout default             experiment
HEAD



                             T1                master
                                               default




 C0        C1                C4                 C6




                C2      C3           C5




 git checkout default             experiment

git merge experiment
HEAD



                             T1                master
                                               default




 C0        C1                C4                 C6




                C2      C3           C5




 git checkout default             experiment

git merge experiment
default




 C0      C1                C4                 C6            C8




              C2      C3           C5                  C7



                                experiment



git checkout experiment           HEAD
default




C0        C1             C4         C6             C8




               C2   C3        C5             C7



                                      experiment



     git commit                          HEAD
HEAD


                                      default




C0     C1                   C4         C6             C8




            C2         C3        C5             C7



                                         experiment



git checkout default
HEAD


                                                   default




C0     C1                   C4        C6            C8




            C2         C3        C5        C7



                                      experiment



git merge experiment
Why is this cool?
non-linear development
• clone the code that is in production
• create a branch for issue #53 (iss53)
• work for 10 minutes
• someone asks for a hotfix for issue #102
• checkout ‘production’
• create a branch (iss102)
• fix the issue
• checkout ‘production’, merge ‘iss102’
• push ‘production’
• checkout ‘iss53’ and keep working
production




origin/master      C1




                   C0



                             git clone
production




origin/master      C1        iss53




                   C0



                                     git checkout -b iss53
iss53




                production   C2



origin/master      C1




                   C0



                                     git commit
iss53




                             C3



                production   C2



origin/master      C1




                   C0



                                     git commit
iss53




                             C3



                production   C2



origin/master      C1                      iss102




                   C0

                                     git checkout production
                                      git checkout -b iss102
iss53




                             C3      iss102




                production   C2       C4



origin/master      C1




                   C0


                                     git commit
iss53




                production   C3



   iss102          C4        C2



origin/master      C1




                   C0

                                     git checkout production
                                          git merge iss102
iss53




                production   C3



origin/master      C4        C2



                   C1




                   C0


                                     git push
iss53




                             C5



                production   C3



origin/master      C4        C2



                   C1




                   C0
                                     git checkout iss53
                                         git commit
iss53




                                               C5



                production                     C3



origin/master      C4        iss53v2           C2



                   C1




                   C0
                                       git checkout production
                                        git checkout -b iss53v2
iss53v2   iss53




                                        C5
                               C7



                production              C3
                               C6



origin/master      C4                   C2



                   C1




                   C0
                                       git commit
                                       git commit
try out an idea
isolate work units
long running topics
all local, so far
Remotes
sharing git
git clone git://github.com/schacon/simplegit2.git
distributed workflow
distributed workflow
     fetch, pull and push
fetch
pull
pull = fetch + merge
push
git push
a who in the what now?
local repo




           public repo                public repo




internet




                         local repo


                         A   B    C
local repo




               public repo                 public repo


           A   B   C

internet

                   git push
                    (ssh)


                              local repo


                              A   B    C
local repo



                   git fetch   A   B    C

                     (git)



               public repo                  public repo


           A   B   C

internet

                   git push
                    (ssh)


                               local repo


                               A   B    C
local repo



                   git fetch   A   B    C

                     (git)     D   E    F   git commit



               public repo                    public repo


           A   B   C

internet

                   git push
                    (ssh)


                               local repo


                               A   B    C
local repo



                   git fetch   A   B    C   git push
                     (git)     D   E    F    (ssh)



               public repo                  public repo


           A   B   C                           A   B      C

internet                                       D   E      F




                   git push
                    (ssh)


                               local repo


                               A   B    C
local repo



                   git fetch   A   B    C   git push
                     (git)     D   E    F    (ssh)



               public repo                  public repo


           A   B   C                           A   B      C

internet                                       D   E      F




                   git push                 git fetch
                    (ssh)                    (http)


                               local repo


                               A   B    C

                               D   E    F
local repo



                   git fetch   A   B    C   git push
                     (git)     D   E    F    (ssh)



               public repo                  public repo


           A   B   C                           A   B      C

internet   D   E   F                           D   E      F




                   git push                 git fetch
                    (ssh)                    (http)


                               local repo


                               A   B    C

                               D   E    F
multiple remotes
developer                               developer
  nick                                   jessica




                      ce0   4a7   5ec    master

            my repo   e4a
developer                               developer
  nick                                   jessica




                            commit
                      ce0   4a7   5ec    master

            my repo   e4a
developer                                developer
  nick                                    jessica




                            tree
                      ce0    4a7   5ec    master

            my repo   e4a
developer                                developer
  nick                                    jessica




                      blobs
                       ce0   4a7   5ec    master

            my repo    e4a
developer                                       developer
  nick                                           jessica




                              ce0   4a7   5ec
                   schacon/
                              e4a
                    project

                   "public"




 git push public
                              ce0   4a7   5ec    master

                   my repo    e4a                public/master
ce0   4a7   5ec
developer                                                  developer
            e4a
  nick                                                      jessica


                              git clone (url)

                                         ce0   4a7   5ec
                              schacon/
                                         e4a
                               project

                              "public"




                                         ce0   4a7   5ec    master

                              my repo    e4a                public/master
ce0   4a7   5ec
developer                                                  developer
            e4a
  nick                                                      jessica
            24f   ec5   c12



                               git commit

                                         ce0   4a7   5ec
                              schacon/
                                         e4a
                               project

                              "public"




                                         ce0   4a7   5ec    master

                              my repo    e4a                public/master
ce0   4a7   5ec                                                 ce0   4a7   5ec
developer                                                  developer
            e4a                                                             e4a
  nick
            24f   ec5   c12   git clone (url)               jessica




                                         ce0   4a7   5ec
                              schacon/
                                         e4a
                               project

                              "public"




                                         ce0   4a7   5ec    master

                              my repo    e4a                public/master
ce0   4a7   5ec                                                 ce0   4a7   5ec
developer                                                  developer
            e4a                                                             e4a
  nick                                                      jessica
            24f   ec5   c12                                                 4ea   df7   2fb

                                 git commit                                 a09




                                         ce0   4a7   5ec
                              schacon/
                                         e4a
                               project

                              "public"




                                         ce0   4a7   5ec    master

                              my repo    e4a                public/master
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb

                                   git push                                a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12                                                4ea   df7   2fb
                              "public"                                     a09




                                         ce0   4a7   5ec   master

                              my repo    e4a               public/master
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12                                                4ea   df7   2fb
 "nick"                       "public"                                     a09




                                         ce0   4a7   5ec   master

                              my repo    e4a               public/master




git remote add nicknick git://github.com/nickh/project.git
       git remote add git://github.com/nickh/project.git
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12                                                4ea   df7   2fb

“nick”
 "nick"                       "public"                                     a09




                                         ce0   4a7   5ec   master

                              my repo    e4a               public/master




git remote add nicknick git://github.com/nickh/project.git
       git remote add git://github.com/nickh/project.git
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12                                                4ea   df7   2fb
 "nick"                       "public"                      "jess"         a09




                                         ce0   4a7   5ec   master

                              my repo    e4a               public/master




git remote add add jess git://github.com/jessica/project.git
       git remote jess git://github.com/jessica/project.git
ce0   4a7   5ec                                                 ce0   4a7   5ec
developer                                                  developer
            e4a                                                             e4a
  nick                                                      jessica
            24f   ec5   c12                                                 4ea   df7   2fb
                                                                            a09




            ce0   4a7   5ec              ce0   4a7   5ec                    ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                                e4a
 project                       project                       project
            24f   ec5   c12                                                 4ea   df7   2fb
 "nick"                       "public"                     “jess”
                                                             "jess"         a09




                                         ce0   4a7   5ec   master

                              my repo    e4a                public/master




git remote add add jess git://github.com/jessica/project.git
       git remote jess git://github.com/jessica/project.git
5ec                ce0   4a7   5ec                   ce0   4a7   5ec
      schacon/                        jessica/
                   e4a                               e4a
       project     ce0   4a7   5ec     project                                         ce0   4a7   5ec
c12   developer                                      4ea   df7   2fb   developer
                   e4a                                                                 e4a
      "public"
         nick                          "jess"        a09                jessica
                   24f   ec5   c12                                                     4ea   df7   2fb
                                                                                       a09




                   ce0   4a7   5ec   master          ce0   4a7   5ec                   ce0   4a7   5ec
       nickh/                         schacon/                          jessica/
      my repo      e4a               public/master   e4a                               e4a
       project                         project                           project
                   24f   ec5   c12   nick/master                                       4ea   df7   2fb
       "nick"                        "public"                           "jess"         a09




       git fetch nick
                                                     ce0   4a7   5ec   master

                                     my repo         e4a               public/master




                                 git fetch nick
                  git remote add jess git://github.com/jessica/project.git
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12                                                4ea   df7   2fb
 "nick"                       "public"                       "jess"        a09




                                         ce0   4a7   5ec   master

                              my repo    e4a               public/master

                                         24f   ec5   c12   nick/master




                               git fetch nick
nickh/                      schacon/                            jessic
                                          e4a                                e4a
                                project                      project                             proje
                                          24f   ec5   c12
             ce0   4a7   5ec                                                 ce0   4a7   5ec
developer                       "nick"                      "public"
                                                            developer                            "jess
             e4a                                                             e4a
  nick                                                       jessica
             24f   ec5   c12                                                 4ea   df7   2fb
                                                                             a09




                                                                             ce0   4a7   5ec   master

             ce0   4a7   5ec              ce0   4a7   5ec   my repo          e4a
                                                                             ce0   4a7   5ec   public/
 nickh/                        schacon/                     jessica/
             e4a                          e4a                                24f
                                                                             e4a   ec5   c12   nick/ma
 project                        project                      project
             24f   ec5   c12                                                 4ea
                                                                             4ea   df7
                                                                                   df7   2fb
                                                                                         2fb   jess/ma

 "nick"                        "public"                       "jess"         a09
                                                                             a09




                                                              git fetch jess

                                          ce0   4a7   5ec   master
                                                             master

                               my repo    e4a               public/master
                                                             public/master

                                          24f   ec5   c12   nick/master




                           git fetchnick
                             git fetch jess
            git remote add jess git://github.com/jessica/project.git
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12                                                4ea   df7   2fb
 "nick"                       "public"                       "jess"        a09




                                         ce0   4a7   5ec   master

                              my repo    e4a               public/master

                                         24f   ec5   c12   nick/master

                                         4ea   df7   2fb   jess/master

                                         a09




                               git fetch jess
ce0   4a7   5ec                                                ce0   4a7   5ec
 developer                                                  developer
             e4a                                                            e4a
   nick                                                      jessica
             24f   ec5   c12                                                4ea   df7   2fb
                                                                            a09




             ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
  nickh/                       schacon/                      jessica/
             e4a                          e4a                               e4a
  project                       project                       project
             24f   ec5   c12                                                4ea   df7   2fb
  "nick"                       "public"                       "jess"        a09




                                          ce0   4a7   5ec
                               my repo    e4a               public/master

                                          24f   ec5   c12   nick/master

                                          4ea   df7   2fb   jess/master

                                          a09   c63   b3b   master




git merge nick jess
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12              24f   ec5   c12                   4ea   df7   2fb
 "nick"                       "public"   4ea   df7   2fb     "jess"        a09
                                         a09   c63   b3b




                                         ce0   4a7   5ec
                              my repo    e4a
                                         24f   ec5   c12   nick/master

                                         4ea   df7   2fb   jess/master

                                         a09   c63   b3b   master

                                                           public/master


git push public
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12              24f   ec5   c12                   4ea   df7   2fb
 "nick"                       "public"   4ea   df7   2fb     "jess"        a09
                                         a09   c63   b3b




                                         ce0   4a7   5ec
                              my repo    e4a
                                         24f   ec5   c12   nick/master

                                         4ea   df7   2fb   jess/master

                                         a09   c63   b3b   master

                                                           public/master
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12              24f   ec5   c12                   4ea   df7   2fb
 "nick"                       "public"   4ea   df7   2fb     "jess"        a09
                                         a09   c63   b3b




                                         ce0   4a7   5ec
                              my repo    e4a
                                         24f   ec5   c12   nick/master

                                         4ea   df7   2fb   jess/master

                                         a09   c63   b3b   master

                                                           public/master
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12              24f   ec5   c12                   4ea   df7   2fb
 "nick"                       "public"   4ea   df7   2fb     "jess"        a09
                                         a09   c63   b3b




                                         ce0   4a7   5ec
                              my repo    e4a
                                         24f   ec5   c12   nick/master

                                         4ea   df7   2fb   jess/master

                                         a09   c63   b3b   master

                                                           public/master
ce0   4a7   5ec                                                ce0   4a7   5ec
developer                                                  developer
            e4a                                                            e4a
  nick                                                      jessica
            24f   ec5   c12                                                4ea   df7   2fb
                                                                           a09




            ce0   4a7   5ec              ce0   4a7   5ec                   ce0   4a7   5ec
 nickh/                       schacon/                      jessica/
            e4a                          e4a                               e4a
 project                       project                       project
            24f   ec5   c12              24f   ec5   c12                   4ea   df7   2fb
 "nick"                       "public"   4ea   df7   2fb     "jess"        a09
                                         a09   c63   b3b




                                         ce0   4a7   5ec
                              my repo    e4a
                                         24f   ec5   c12   nick/master

                                         4ea   df7   2fb   jess/master

                                         a09   c63   b3b   master

                                                           public/master
popular workflows
central repository
      model
developer             developer

developer                                     developer


                   shared repository
developer                                     developer



            developer             developer
shared repository




developer      developer        developer




            git clone
shared repository




developer      developer        developer




            git push
shared repository




developer      developer        developer




            git push
shared repository




developer      developer        developer
shared repository




developer       developer        developer




             git fetch
            git merge
shared repository




developer      developer        developer




            git push
dictator and lieutenants
         model
dictator                                 blessed repository




             lieutenant

lieutenant




developer         developer   developer                developer
dictator                                    blessed repository




             lieutenant

lieutenant




developer         developer      developer                developer




                          git clone
dictator                                 blessed repository




             lieutenant

lieutenant




developer         developer   developer                developer


     git fetch
    git merge
dictator                                     blessed repository




             lieutenant

lieutenant




developer         developer       developer                developer


                               git fetch
                              git merge
git fetch; git merge
  dictator                                 blessed repository




              lieutenant

 lieutenant




 developer         developer   developer                developer
git push
 dictator                                 blessed repository




             lieutenant

lieutenant




developer         developer   developer                developer
dictator                                    blessed repository




             lieutenant

lieutenant




developer         developer      developer                developer




                          git fetch
integration manager
       model
blessed
repository    developer   developer
                public      public




integration   developer   developer
 manager       private     private
github.com
/schacon/ticgit
    blessed
                     /yob/ticgit   /pope/ticgit
   repository         developer      developer
                        public         public




   integration        developer      developer
    manager            private        private
github.com
/schacon/ticgit                 “forks”
    blessed
                     /yob/ticgit        /pope/ticgit
   repository         developer          developer
                        public             public




   integration        developer          developer
    manager            private            private
blessed
 repository    developer   developer
                 public      public




 integration   developer   developer
  manager       private     private


git push
blessed
repository       developer   developer
                   public      public




integration      developer   developer
 manager          private     private



              git clone
blessed
repository      developer   developer
                  public      public




integration     developer   developer
 manager         private     private



              git push
blessed
repository    developer     developer
                public        public




integration   developer     developer
 manager       private       private


                           git fetch
                          git merge
blessed
repository    developer    developer
                public       public




integration   developer    developer
 manager       private      private



                          git push
blessed
repository     developer   developer
                 public      public




integration    developer   developer
 manager        private     private


   git fetch
  git merge
blessed
 repository    developer   developer
                 public      public




 integration   developer   developer
  manager       private     private



git push
Remotes Are Branches
scott   jessica




default




 C1




 C0
scott              jessica




default           scott/default        default




 C1                   C1




 C0                   C0
scott                    jessica




default
            git clone   scott/default        default




 C1                         C1




 C0                         C0
scott              jessica




default           scott/default        default




 C1                   C1




 C0                   C0
scott              jessica




default           scott/default        default




 C1                   C1




 C0                   C0
scott              jessica


                                       default




                                        C4



                                        C3




default           scott/default         C2




 C1                   C1




 C0                   C0
scott              jessica


                                       default




                                        C4



                                        C3




default           scott/default         C2




 C1                   C1




 C0                   C0
scott              jessica


                                       default




                                        C4



                                        C3




default           scott/default         C2




 C1                   C1




 C0                   C0
scott              jessica


default                                default




 C7                                     C4



 C6                                     C3



 C5               scott/default         C2




 C1                   C1




 C0                   C0
scott              jessica


default                                default




 C7                                     C4



 C6                                     C3



 C5               scott/default         C2




 C1                   C1




 C0                   C0
scott              jessica


default           scott/default        default




 C7                   C7                C4



 C6                   C6                C3



 C5                   C5                C2




 C1                   C1




 C0                   C0
scott                     jessica


default   scott/default    default   experiment




 C7           C7            C4          C9



 C6           C6            C3          C8



 C5           C5            C2




 C1           C1




 C0           C0
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation
Git 101 Presentation

More Related Content

What's hot

Git Terminologies
Git TerminologiesGit Terminologies
Git TerminologiesYash
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHubNicolás Tourné
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsCarl Brown
 
Git基礎介紹
Git基礎介紹Git基礎介紹
Git基礎介紹Max Ma
 
Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version ControlSourabh Sahu
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 
Learning git
Learning gitLearning git
Learning gitSid Anand
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git RightSven Peters
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to gitEmanuele Olivetti
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notesglen_a_smith
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow soloviniciusban
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash CourseNilay Binjola
 

What's hot (20)

Git Terminologies
Git TerminologiesGit Terminologies
Git Terminologies
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Starting with Git & GitHub
Starting with Git & GitHubStarting with Git & GitHub
Starting with Git & GitHub
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
 
Git基礎介紹
Git基礎介紹Git基礎介紹
Git基礎介紹
 
Git basics
Git basicsGit basics
Git basics
 
Understanding GIT and Version Control
Understanding GIT and Version ControlUnderstanding GIT and Version Control
Understanding GIT and Version Control
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Learning git
Learning gitLearning git
Learning git
 
Git
GitGit
Git
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Getting Git Right
Getting Git RightGetting Git Right
Getting Git Right
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Gitlab flow solo
Gitlab flow soloGitlab flow solo
Gitlab flow solo
 
Git Tutorial 教學
Git Tutorial 教學Git Tutorial 教學
Git Tutorial 教學
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 

Git 101 Presentation

  • 3. Me
  • 5.
  • 7.
  • 11. </me>
  • 13. Git is an open source, distributed version control system designed for speed and efficiency
  • 15. mercurial (hg) bazaar subversion (svn) version control concurrent version system (cvs) perforce visual source safe
  • 16. SoS mercurial (hg) bazaar subversion (svn) version control concurrent version system (cvs) perforce visual source safe
  • 17. SoS mercurial (hg) “not bad” bazaar subversion (svn) version control concurrent version system (cvs) perforce visual source safe
  • 18. SoS mercurial (hg) bazaar subversion (svn) version control concurrent version system (cvs) perforce visual source safe “kill self”
  • 19. git mercurial (hg) bazaar subversion (svn) version control concurrent version system (cvs) perforce visual source safe
  • 20. Git is an open source, distributed version control system designed for speed and efficiency
  • 22. Git is an open source, distributed version control system designed for speed and efficiency
  • 25. which means everything is fast every clone is a backup work offline
  • 26. No Network Needed Performing a diff Viewing file history Committing changes Merging branches Obtaining other revisions of a file Switching branches
  • 27. Git is an open source, distributed version control system designed for speed and efficiency
  • 28.
  • 32.         delta storage             snapshot      storage          
  • 33.         delta storage             snapshot      storage          
  • 34.         delta storage             snapshot      storage          
  • 35.         delta storage             snapshot      storage          
  • 36.         delta storage             snapshot      storage          
  • 37.         delta storage             snapshot      storage          
  • 38.         delta storage             snapshot      storage          
  • 39.         delta storage             snapshot      storage          
  • 40.         delta storage             snapshot      storage          
  • 41.         delta storage             snapshot      storage          
  • 42.         delta storage             snapshot      storage          
  • 43.         delta storage             snapshot      storage          
  • 44.         delta storage             snapshot      storage          
  • 45.         delta storage             snapshot      storage          
  • 46.         delta storage             snapshot      storage          
  • 49. $ git config --global user.name “Scott Chacon” $ git config --global user.email “schacon@gmail.com”
  • 53. $ touch hello_world.rb $ git init $ git add . $ git commit -m ‘first commit’
  • 54. $ touch hello_world.rb $ git init $ git add . $ git commit -m ‘first commit’
  • 55. $ tree -a . |-- .git | |-- HEAD | |-- branches | |-- config | |-- description | |-- hooks | | |-- post-commit.sample | | |-- post-receive.sample | | |-- ... | | |-- pre-rebase.sample | | `-- update.sample | |-- info | | `-- exclude | |-- objects | | |-- info | | `-- pack | |-- refs | | |-- heads | | `-- tags | `-- remotes `-- hello_world.rb 11 directories, 25 files
  • 56. $ tree -a . |-- .git | |-- HEAD | |-- branches | |-- config | |-- description | |-- hooks | | |-- post-commit.sample | | |-- post-receive.sample | | |-- ... | | |-- pre-rebase.sample | | `-- update.sample | |-- info | | `-- exclude | |-- objects | | |-- info | | `-- pack | |-- refs | | |-- heads | | `-- tags | `-- remotes `-- hello_world.rb 11 directories, 25 files
  • 57. $ tree -a . |-- .git | |-- HEAD | |-- branches | |-- config | |-- description | |-- hooks | | |-- post-commit.sample | | |-- post-receive.sample | | |-- ... | | |-- pre-rebase.sample | | `-- update.sample | |-- info | | `-- exclude | |-- objects | | |-- info | | `-- pack | |-- refs | | |-- heads | | `-- tags | `-- remotes `-- hello_world.rb 11 directories, 25 files
  • 58. $ touch hello_world.rb $ git init $ git add . $ git commit -m ‘first commit’
  • 59. $ touch hello_world.rb $ git init $ git add . $ git commit -m ‘first commit’
  • 60. $ tree -a . |-- .git | |-- COMMIT_EDITMSG | |-- HEAD | |-- branches | |-- config | |-- description | |-- hooks | | |-- applypatch-msg.sample | | `-- update.sample | |-- index | |-- info | | `-- exclude | |-- logs | | |-- HEAD | | `-- refs | | `-- heads | | `-- master | |-- objects | | |-- 32/09658ac8d80bc9726d3a33d77e3dfc5fe6035e | | |-- 53/9cd7886a627841d525a78d45cbc6396be20b41 | | |-- e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 | | |-- info | | `-- pack | |-- refs | | |-- heads | | | `-- master | | `-- tags | `-- remotes `-- hello_world.rb 17 directories, 33 files
  • 61. $ tree -a . |-- .git | |-- COMMIT_EDITMSG | |-- HEAD | |-- branches | |-- config | |-- description | |-- hooks | | |-- applypatch-msg.sample | | `-- update.sample | |-- index | |-- info | | `-- exclude | |-- logs | | |-- HEAD | | `-- refs | | `-- heads | | `-- master | |-- objects | | |-- 32/09658ac8d80bc9726d3a33d77e3dfc5fe6035e | | |-- 53/9cd7886a627841d525a78d45cbc6396be20b41 | | |-- e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 | | |-- info | | `-- pack | |-- refs | | |-- heads | | | `-- master | | `-- tags | `-- remotes `-- hello_world.rb 17 directories, 33 files
  • 62. $ tree -a . |-- .git | |-- COMMIT_EDITMSG | |-- HEAD | |-- branches | |-- config | |-- description | |-- hooks | | |-- applypatch-msg.sample | | `-- update.sample | |-- index | |-- info | | `-- exclude | |-- logs | | |-- HEAD | | `-- refs | | `-- heads | | `-- master | |-- objects | | |-- 32/09658ac8d80bc9726d3a33d77e3dfc5fe6035e | | |-- 53/9cd7886a627841d525a78d45cbc6396be20b41 | | |-- e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 | | |-- info | | `-- pack | |-- refs | | |-- heads | | | `-- master | | `-- tags | `-- remotes `-- hello_world.rb 17 directories, 33 files
  • 65. $ git clone git://github.com/schacon/ticgit.git Initialized empty Git repository in /private/tmp/ticgit/.git/ remote: Counting objects: 591, done. remote: Compressing objects: 100% (267/267), done. remote: Total 591 (delta 253), reused 587 (delta 252) Receiving objects: 100% (591/591), 73.05 KiB, done. Resolving deltas: 100% (253/253), done. $ cd ticgit/ $ ls LICENSE! ! Rakefile! examples! note! ! ticgit.gemspec README! ! bin! lib! spec ! ! $
  • 66. $ git clone git://github.com/schacon/ticgit.git Initialized empty Git repository in /private/tmp/ticgit/.git/ remote: Counting objects: 591, done. remote: Compressing objects: 100% (267/267), done. remote: Total 591 (delta 253), reused 587 (delta 252) Receiving objects: 100% (591/591), 73.05 KiB, done. Resolving deltas: 100% (253/253), done. $ cd ticgit/ $ ls LICENSE! ! Rakefile! examples! note! ! ticgit.gemspec README! ! bin! lib! spec ! ! $
  • 67. $ git clone git://github.com/schacon/ticgit.git Initialized empty Git repository in /private/tmp/ticgit/.git/ remote: Counting objects: 591, done. remote: Compressing objects: 100% (267/267), done. remote: Total 591 (delta 253), reused 587 (delta 252) Receiving objects: 100% (591/591), 73.05 KiB, done. Resolving deltas: 100% (253/253), done. $ cd ticgit/ $ ls LICENSE! ! Rakefile! examples! note! ! ticgit.gemspec README! ! bin! lib! spec ! ! $
  • 68. $ git clone git://github.com/schacon/ticgit.git Initialized empty Git repository in /private/tmp/ticgit/.git/ remote: Counting objects: 591, done. remote: Compressing objects: 100% (267/267), done. remote: Total 591 (delta 253), reused 587 (delta 252) Receiving objects: 100% (591/591), 73.05 KiB, done. Resolving deltas: 100% (253/253), done. $ cd ticgit/ $ ls .git LICENSE! ! Rakefile! examples! note! ! ticgit.gemspec README!! bin!! lib!! spec $
  • 70. A Basic Workflow Edit files Stage the changes Review your changes Commit the changes
  • 71. working directory git add index git commit repository
  • 72. a working copy working directory of your project git add index git commit repository
  • 73. working directory git add index git commit object database repository
  • 74. working directory git add index “staging” git commit repository
  • 75. A Basic Workflow Edit files Stage the changes Review your changes Commit the changes
  • 77. $ vim main.py #!/usr/bin/env python import wsgiref.handlers from google.appengine.ext import webapp class MainHandler(webapp.RequestHandler): def get(self): self.response.out.write('Hello world!') def main(): application = webapp.WSGIApplication([('/', MainHandler)], debug=True) wsgiref.handlers.CGIHandler().run(application) if __name__ == '__main__': main() ~ ~ "main.py" 16L, 402C
  • 78. $ vim main.py #!/usr/bin/env python import wsgiref.handlers from google.appengine.ext import webapp # this program prints out ‘hello world’ class MainHandler(webapp.RequestHandler): def get(self): self.response.out.write('Hello world!') def main(): application = webapp.WSGIApplication([('/', MainHandler)], debug=True) wsgiref.handlers.CGIHandler().run(application) if __name__ == '__main__': main() ~ ~ "main.py" 16L, 402C
  • 80. $ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what # # modified: main.py # no changes added to commit (use "git add" an
  • 81. $ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what # # modified: main.py # no changes added to commit (use "git add" an
  • 82. $ git status # On branch master # Changed but not updated: # (use "git add <file>..." to update what # # modified: main.py # no changes added to commit (use "git add" an
  • 83. $ git status # On branch master # Changed but not STAGED updated: # (use "git add <file>..." to update what # # modified: main.py # no changes added to commit (use "git add" an
  • 84. A Basic Workflow Edit files Stage the changes Review your changes Commit the changes
  • 86. working directory git add index git commit repository
  • 87. working directory git add index git commit repository
  • 88. $ git add main.py $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>. # # modified: main.py #
  • 89. $ git add main.py $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>. # # modified: main.py #
  • 90. $ git add main.py $ git status # On branch master # Changes to be committed: THAT ARE STAGED # (use "git reset HEAD <file>. # # modified: main.py #
  • 91. $ vim app.yaml application: chacon version: 1 runtime: python api_version: 1 handlers: - url: .* script: main.py ~ ~ ~ "app.yaml" 8L, 101C
  • 92. $ vim app.yaml application: chacon version: 1 runtime: python api_version: 1 handlers: - url: .* script: main.py ~ ~ ~ "app.yaml" 8L, 101C
  • 93. $ vim app.yaml application: chacon version: 2 runtime: python api_version: 1 handlers: - url: .* script: main.py ~ ~ ~ "app.yaml" 8L, 101C
  • 94. $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: main.py # # Changed but not updated: # (use "git add <file>..." to update what will be com # # modified: app.yaml #
  • 95. $ vim main.py #!/usr/bin/env python import wsgiref.handlers from google.appengine.ext import webapp # this program prints out ‘hello world’ class MainHandler(webapp.RequestHandler): def get(self): self.response.out.write('Hello world!') def main(): application = webapp.WSGIApplication([('/', MainHandler)], debug=True) wsgiref.handlers.CGIHandler().run(application) if __name__ == '__main__': main() ~ ~ "main.py" 16L, 402C
  • 96. $ vim main.py #!/usr/bin/env python import wsgiref.handlers from google.appengine.ext import webapp # this program prints out ‘hello world’ class MainHandler(webapp.RequestHandler): def get(self): self.response.out.write('Hola world!') def main(): application = webapp.WSGIApplication([('/', MainHandler)], debug=True) wsgiref.handlers.CGIHandler().run(application) if __name__ == '__main__': main() ~ ~ "main.py" 16L, 402C
  • 97. $ vim main.py #!/usr/bin/env python import wsgiref.handlers from google.appengine.ext import webapp # this program prints out ‘hello world’ class MainHandler(webapp.RequestHandler): def get(self): self.response.out.write('Hola Mundo!') def main(): application = webapp.WSGIApplication([('/', MainHandler)], debug=True) wsgiref.handlers.CGIHandler().run(application) if __name__ == '__main__': main() ~ ~ "main.py" 16L, 402C
  • 98. $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: main.py # # Changed but not updated: # (use "git add <file>..." to update what will be com # # modified: app.yaml # modified: main.py #
  • 99. $ git status # On branch master # Changes to be committed: Staged # (use "git reset HEAD <file>..." to unstage) # # modified: main.py # # Changed but not updated: # (use "git add <file>..." to update what will be com # # modified: app.yaml # modified: main.py #
  • 100. $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: main.py # # Changed but not updated: Unstaged # # (use "git add <file>..." to update what will be com # modified: app.yaml # modified: main.py #
  • 101. $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: main.py # # Changed but not updated: # (use "git add <file>..." to update what will be com # # modified: app.yaml # modified: main.py #
  • 102. Staged In Working Directory #!/usr/bin/env python #!/usr/bin/env python import wsgiref.handlers import wsgiref.handlers from google.appengine.ext import webapp from google.appengine.ext import webapp # this program prints out ‘hello world’ # this program prints out ‘hello world’ class MainHandler(webapp.RequestHandler): class MainHandler(webapp.RequestHandler): def get(self): def get(self): self.response.out.write('Hello World!') self.response.out.write('Hola Mundo!') def main(): def main(): application = webapp.WSGIApplication application = webapp.WSGIApplication ([('/' ([('/' debug=True) debug=True) wsgiref.handlers.CGIHandler().run wsgiref.handlers.CGIHandler().run (applicat (applicat if __name__ == '__main__': if __name__ == '__main__': main() main()
  • 103. Staged In Working Directory #!/usr/bin/env python #!/usr/bin/env python import wsgiref.handlers import wsgiref.handlers from google.appengine.ext import webapp from google.appengine.ext import webapp # this program prints out ‘hello world’ # this program prints out ‘hello world’ class MainHandler(webapp.RequestHandler): class MainHandler(webapp.RequestHandler): def get(self): def get(self): self.response.out.write('Hello World!') self.response.out.write('Hola Mundo!') def main(): def main(): application = webapp.WSGIApplication application = webapp.WSGIApplication ([('/' ([('/' debug=True) debug=True) wsgiref.handlers.CGIHandler().run wsgiref.handlers.CGIHandler().run (applicat (applicat if __name__ == '__main__': if __name__ == '__main__': main() main()
  • 104. You have to stage a file after you edit it
  • 105. You have to stage a file after you edit it
  • 106. You have to stage a file after you edit it
  • 107. $ git add app.yaml main.py $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: app.yaml # modified: main.py #
  • 108. A Basic Workflow Edit files Stage the changes Review your changes Commit the changes
  • 110. working directory git add index git commit repository
  • 111. working directory git add index git commit repository
  • 112. $ git commit # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: app.yaml # modified: main.py # ~ ~ ~ ~ ".git/COMMIT_EDITMSG" 10L, 279C
  • 113. $ git commit descriptive commit message # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: app.yaml # modified: main.py # ~ ~ ~ ~ ".git/COMMIT_EDITMSG" 10L, 279C
  • 114. $ git commit descriptive commit message # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: app.yaml # modified: main.py # ~ ~ ~ ~ ".git/COMMIT_EDITMSG" 10L, 279C
  • 115. $ git commit Created commit 77d3001: descriptive commit message 2 files changed, 4 insertions(+), 2 deletions(-)
  • 116. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file) Review your changes repo status Commit the changes git commit
  • 117. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file) Review your changes repo status Commit the changes git commit
  • 118. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file) Review your changes repo status Commit the changes git commit
  • 119. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file) Review your changes git status Commit the changes git commit
  • 120. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file) Review your changes git status Commit the changes git commit
  • 121. A Basicer Workflow Edit files vim / emacs / etc Stage and Commit git commit -a
  • 123. $ git commit Created commit 77d3001: descriptive commit message 2 files changed, 4 insertions(+), 2 deletions(-)
  • 124. $ git commit Created commit 77d3001: descriptive commit message 2 files changed, 4 insertions(+), 2 deletions(-)
  • 128. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b ae668.. commit size tree c4ec5 parent a149e author Scott committer Scott my commit message goes here and it is really, really cool
  • 129. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b ae668.. commit size tree c4ec543b0322744e55c5efc9b6c4e449d398dbff parent a149e2160b3f7573768cdc2fce24d0881f3577e1 tree c4ec5 author Scott Chacon <schacon@gmail.com> 1223402504 -0700 committer Scott Chaconparent <schacon@gmail.com> 1223402504 -0700 a149e author Scott descriptive commit message committer Scott my commit message goes here and it is really, really cool
  • 130. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b ae668.. commit size tree c4ec5 parent a149e author Scott committer Scott my commit message goes here and it is really, really cool
  • 131. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b ae668.. commit size tree c4ec5 parent a149e author Scott committer Scott my commit message goes here and it is really, really cool ./ c4e app.yaml 3d5 index.yaml 1d3 main.py 03e
  • 132. ae668.. commit size commit size tree 2de54 tree c4ec5 parent 38def parent a149e author Scott author Scott committer Scott this is the previous commit committer Scott and I am very proud of it my commit message goes here and it is really, really cool ./ c4e app.yaml 3d5 index.yaml 1d3 main.py 03e
  • 133. ae668.. commit size commit size tree 2de54 tree c4ec5 parent 38def parent a149e author Scott author Scott committer Scott this is the previous commit committer Scott and I am very proud of it my commit message goes here and it is really, really cool ./ c4e app.yaml 3d5 index.yaml 1d3 ./ c4e main.py 03e app.yaml 3d5 index.yaml 1d3 main.py 03e
  • 134. ae668.. commit size commit size commit size commit size tree 2de54 tree c4ec5 tree 2fe65 tree parent author 2fe65 90ecd parent 90ecd parent 38def parent a149e Scott author Scott author author committer Scott committer Scott this is the commit before that and I'm not sure why Scott Scott this is the commit before that and I'm not sure why committer Scott this is the previous commit committer Scott and I am very proud of it ./ c4e app.yaml 3d5 my commit message goes here ./ c4e index.yaml 1d3 and it is really, really cool app.yaml 3d5 main.py 03e index.yaml 1d3 ./ c4e main.py 03e app.yaml 3d5 index.yaml 1d3 ./ c4e main.py 03e app.yaml 3d5 index.yaml 1d3 main.py 03e
  • 135. ae668.. commit size commit size commit size commit size tree 2de54 tree c4ec5 tree 2fe65 tree parent author 48e 2fe65 90ecd parent 38d 90ecd parent a14 38def parent 77d a149e Scott author Scott author author committer Scott committer Scott this is the commit before that and I'm not sure why Scott Scott this is the commit before that and I'm not sure why committer Scott this is the previous commit committer Scott and I am very proud of it ./ c4e 3d5 my commit message goes here 32a app.yaml c4e ./ index.yaml 1d3 and it is really, really cool app.yaml 3d5 main.py 03e index.yaml 5b1 1d3 c4e ./ f46 main.py 03e app.yaml 23f 3d5 index.yaml 30e 1d3 ./ c4e main.py 67e 03e app.yaml 3d5 index.yaml 1d3 main.py 03e 03e
  • 136. Repository 5b1 32a c36 1d3 f46 3d4 ffe 6fe ae6 38d 23f 03e 254 30e 5b1 a14 67e 1d3 3d5 735 d23 c4e c4e 48e 77d de3 2d3
  • 137. Repository 5b1 32a c36 1d3 f46 3d4 ffe 6fe ae6 git checkout ae635 38d 23f 03e 254 30e 5b1 a14 67e 1d3 3d5 735 d23 c4e c4e 48e 77d de3 2d3
  • 138. Repository 5b1 32a c36 1d3 f46 3d4 ffe 6fe ae6 git checkout ae635 38d 23f 03e 254 30e 5b1 a14 67e 1d3 3d5 735 d23 c4e c4e 48e 77d de3 2d3
  • 139. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 Rakefile 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3
  • 140. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 Rakefile 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3
  • 141. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 Rakefile 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3
  • 142. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 Rakefile 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3
  • 143. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 Rakefile 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3 git add
  • 144. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 Rakefile 34f 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3 git add
  • 145. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 34f Rakefile 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3 34f 3da a08 ae9 git commit
  • 146. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 34f Rakefile 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3 34f 3da a08 ae9
  • 147. Repository Index Working Directory 5b1 32a c36 ./ 3d4 ./ 1d3 f46 3d4 ffe 6fe ae6 ./Rakefile 1d3 34f Rakefile 38d 23f 03e ./README 03e README 254 30e 5b1 a14 67e 1d3 ./lib/ c36 lib/ 3d5 735 d23 c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb 77d de3 2d3 34f 3da a08 ae9
  • 148. object model pointer to a commit } snapshot C1 directory list tree file contents blob
  • 149. object model pointer to a commit } snapshot C1 directory list tree file contents blob
  • 150. ref commit commit commit tree tree tree blob tree blob tree blob tree blob
  • 157. HEAD default master experiment C0 C1 C2 C3
  • 158. HEAD C4 default master experiment C3 C0 C5 C1 C2 experiment C3 git branch experiment
  • 159. HEAD C4 default master experiment C3 C0 C5 C1 C2 experiment C3 git branch experiment
  • 160. HEAD C4 default master experiment $ git branch C3 C0 C5 C1 * default experiment C2 experiment C3
  • 161. HEAD C4 default master experiment $ git branch C3 C0 C5 C1 * default experiment C2 experiment C3
  • 162. C4 default master experiment C3 C0 C5 C1 C2 experiment C3 HEAD git checkout experiment
  • 163. T1 master default master experiment git commit C0 C4 C1 2 C3 C5 C2 C3 experiment HEAD
  • 164. T1 master default master experiment git commit C0 C4 C1 2 C3 C5 C2 C3 experiment HEAD
  • 165. T1 master default master experiment git commit C0 C4 C1 2 C3 C5 C2 C3 experiment HEAD
  • 166. T1 master default master experiment git commit C1 C0 C1 C4 git commit C2 C3 C2 C5 C3 experiment HEAD
  • 167. HEAD T1 default master git checkout default master experiment C1 C0 C1 C4 C2 C3 C2 C5 C3 experiment
  • 168. HEAD T1 default master git checkout default master experiment C1 C0 C1 C4 C2 C3 C2 C5 C3 experiment
  • 169. git commit T1 T1 master default master HEAD C1 C0 C1 C4 C4 C2 C3 C2 C5 C3 C5 experiment experiment
  • 170. git commit T1 T1 master default master HEAD C1 C0 C1 C4 C4 C2 C3 C2 C5 C3 C5 experiment experiment
  • 171. git commit T1 T1 master default master HEAD C1 C0 C1 C4 C4 C2 C3 C2 C5 C3 C5 experiment experiment
  • 172. T1 default master C0 C1 C4 C2 C3 C5 git checkout experiment experiment git commit HEAD
  • 173. what is a branch, really?
  • 177. $ find .git/refs .git/refs .git/refs/heads .git/refs/heads/default .git/refs/heads/experiment $ cat .git/refs/heads/default 6370409dc9e38af91565082bdf93577ff555489e
  • 178. $ find .git/refs .git/refs .git/refs/heads .git/refs/heads/default .git/refs/heads/experiment $ cat .git/refs/heads/default 6370409dc9e38af91565082bdf93577ff555489e $ cat .git/refs/heads/experiment 33ce13c2f0ed35775956f81191b01a644448dcfc
  • 179. $ cat .git/HEAD ref: refs/heads/experiment
  • 180. $ cat .git/HEAD ref: refs/heads/experiment
  • 181. $ cat .git/HEAD ref: refs/heads/experiment
  • 184. T1 default master C0 C1 C4 C2 C3 C5 experiment HEAD
  • 185. HEAD T1 default master C0 C1 C4 C2 C3 C5 git checkout default experiment
  • 186. HEAD T1 master default C0 C1 C4 C6 C2 C3 C5 git checkout default experiment git merge experiment
  • 187. HEAD T1 master default C0 C1 C4 C6 C2 C3 C5 git checkout default experiment git merge experiment
  • 188. default C0 C1 C4 C6 C8 C2 C3 C5 C7 experiment git checkout experiment HEAD
  • 189. default C0 C1 C4 C6 C8 C2 C3 C5 C7 experiment git commit HEAD
  • 190. HEAD default C0 C1 C4 C6 C8 C2 C3 C5 C7 experiment git checkout default
  • 191. HEAD default C0 C1 C4 C6 C8 C2 C3 C5 C7 experiment git merge experiment
  • 192. Why is this cool?
  • 194. • clone the code that is in production • create a branch for issue #53 (iss53) • work for 10 minutes • someone asks for a hotfix for issue #102 • checkout ‘production’ • create a branch (iss102) • fix the issue • checkout ‘production’, merge ‘iss102’ • push ‘production’ • checkout ‘iss53’ and keep working
  • 195. production origin/master C1 C0 git clone
  • 196. production origin/master C1 iss53 C0 git checkout -b iss53
  • 197. iss53 production C2 origin/master C1 C0 git commit
  • 198. iss53 C3 production C2 origin/master C1 C0 git commit
  • 199. iss53 C3 production C2 origin/master C1 iss102 C0 git checkout production git checkout -b iss102
  • 200. iss53 C3 iss102 production C2 C4 origin/master C1 C0 git commit
  • 201. iss53 production C3 iss102 C4 C2 origin/master C1 C0 git checkout production git merge iss102
  • 202. iss53 production C3 origin/master C4 C2 C1 C0 git push
  • 203. iss53 C5 production C3 origin/master C4 C2 C1 C0 git checkout iss53 git commit
  • 204. iss53 C5 production C3 origin/master C4 iss53v2 C2 C1 C0 git checkout production git checkout -b iss53v2
  • 205. iss53v2 iss53 C5 C7 production C3 C6 origin/master C4 C2 C1 C0 git commit git commit
  • 206. try out an idea
  • 212.
  • 213.
  • 214.
  • 215.
  • 216.
  • 217.
  • 218.
  • 219.
  • 220.
  • 221.
  • 222.
  • 223.
  • 224.
  • 225.
  • 226.
  • 227.
  • 228.
  • 231. distributed workflow fetch, pull and push
  • 232. fetch
  • 233.
  • 234.
  • 235.
  • 236.
  • 237.
  • 238.
  • 239. pull
  • 240. pull = fetch + merge
  • 241. push
  • 242.
  • 243.
  • 244.
  • 246.
  • 247. a who in the what now?
  • 248. local repo public repo public repo internet local repo A B C
  • 249. local repo public repo public repo A B C internet git push (ssh) local repo A B C
  • 250. local repo git fetch A B C (git) public repo public repo A B C internet git push (ssh) local repo A B C
  • 251. local repo git fetch A B C (git) D E F git commit public repo public repo A B C internet git push (ssh) local repo A B C
  • 252. local repo git fetch A B C git push (git) D E F (ssh) public repo public repo A B C A B C internet D E F git push (ssh) local repo A B C
  • 253. local repo git fetch A B C git push (git) D E F (ssh) public repo public repo A B C A B C internet D E F git push git fetch (ssh) (http) local repo A B C D E F
  • 254. local repo git fetch A B C git push (git) D E F (ssh) public repo public repo A B C A B C internet D E F D E F git push git fetch (ssh) (http) local repo A B C D E F
  • 256. developer developer nick jessica ce0 4a7 5ec master my repo e4a
  • 257. developer developer nick jessica commit ce0 4a7 5ec master my repo e4a
  • 258. developer developer nick jessica tree ce0 4a7 5ec master my repo e4a
  • 259. developer developer nick jessica blobs ce0 4a7 5ec master my repo e4a
  • 260. developer developer nick jessica ce0 4a7 5ec schacon/ e4a project "public" git push public ce0 4a7 5ec master my repo e4a public/master
  • 261. ce0 4a7 5ec developer developer e4a nick jessica git clone (url) ce0 4a7 5ec schacon/ e4a project "public" ce0 4a7 5ec master my repo e4a public/master
  • 262. ce0 4a7 5ec developer developer e4a nick jessica 24f ec5 c12 git commit ce0 4a7 5ec schacon/ e4a project "public" ce0 4a7 5ec master my repo e4a public/master
  • 263. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick 24f ec5 c12 git clone (url) jessica ce0 4a7 5ec schacon/ e4a project "public" ce0 4a7 5ec master my repo e4a public/master
  • 264. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb git commit a09 ce0 4a7 5ec schacon/ e4a project "public" ce0 4a7 5ec master my repo e4a public/master
  • 265. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb git push a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 4ea df7 2fb "public" a09 ce0 4a7 5ec master my repo e4a public/master
  • 266. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 4ea df7 2fb "nick" "public" a09 ce0 4a7 5ec master my repo e4a public/master git remote add nicknick git://github.com/nickh/project.git git remote add git://github.com/nickh/project.git
  • 267. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 4ea df7 2fb “nick” "nick" "public" a09 ce0 4a7 5ec master my repo e4a public/master git remote add nicknick git://github.com/nickh/project.git git remote add git://github.com/nickh/project.git
  • 268. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 4ea df7 2fb "nick" "public" "jess" a09 ce0 4a7 5ec master my repo e4a public/master git remote add add jess git://github.com/jessica/project.git git remote jess git://github.com/jessica/project.git
  • 269. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 4ea df7 2fb "nick" "public" “jess” "jess" a09 ce0 4a7 5ec master my repo e4a public/master git remote add add jess git://github.com/jessica/project.git git remote jess git://github.com/jessica/project.git
  • 270. 5ec ce0 4a7 5ec ce0 4a7 5ec schacon/ jessica/ e4a e4a project ce0 4a7 5ec project ce0 4a7 5ec c12 developer 4ea df7 2fb developer e4a e4a "public" nick "jess" a09 jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec master ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ my repo e4a public/master e4a e4a project project project 24f ec5 c12 nick/master 4ea df7 2fb "nick" "public" "jess" a09 git fetch nick ce0 4a7 5ec master my repo e4a public/master git fetch nick git remote add jess git://github.com/jessica/project.git
  • 271. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 4ea df7 2fb "nick" "public" "jess" a09 ce0 4a7 5ec master my repo e4a public/master 24f ec5 c12 nick/master git fetch nick
  • 272. nickh/ schacon/ jessic e4a e4a project project proje 24f ec5 c12 ce0 4a7 5ec ce0 4a7 5ec developer "nick" "public" developer "jess e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec master ce0 4a7 5ec ce0 4a7 5ec my repo e4a ce0 4a7 5ec public/ nickh/ schacon/ jessica/ e4a e4a 24f e4a ec5 c12 nick/ma project project project 24f ec5 c12 4ea 4ea df7 df7 2fb 2fb jess/ma "nick" "public" "jess" a09 a09 git fetch jess ce0 4a7 5ec master master my repo e4a public/master public/master 24f ec5 c12 nick/master git fetchnick git fetch jess git remote add jess git://github.com/jessica/project.git
  • 273. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 4ea df7 2fb "nick" "public" "jess" a09 ce0 4a7 5ec master my repo e4a public/master 24f ec5 c12 nick/master 4ea df7 2fb jess/master a09 git fetch jess
  • 274. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 4ea df7 2fb "nick" "public" "jess" a09 ce0 4a7 5ec my repo e4a public/master 24f ec5 c12 nick/master 4ea df7 2fb jess/master a09 c63 b3b master git merge nick jess
  • 275. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 24f ec5 c12 4ea df7 2fb "nick" "public" 4ea df7 2fb "jess" a09 a09 c63 b3b ce0 4a7 5ec my repo e4a 24f ec5 c12 nick/master 4ea df7 2fb jess/master a09 c63 b3b master public/master git push public
  • 276. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 24f ec5 c12 4ea df7 2fb "nick" "public" 4ea df7 2fb "jess" a09 a09 c63 b3b ce0 4a7 5ec my repo e4a 24f ec5 c12 nick/master 4ea df7 2fb jess/master a09 c63 b3b master public/master
  • 277. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 24f ec5 c12 4ea df7 2fb "nick" "public" 4ea df7 2fb "jess" a09 a09 c63 b3b ce0 4a7 5ec my repo e4a 24f ec5 c12 nick/master 4ea df7 2fb jess/master a09 c63 b3b master public/master
  • 278. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 24f ec5 c12 4ea df7 2fb "nick" "public" 4ea df7 2fb "jess" a09 a09 c63 b3b ce0 4a7 5ec my repo e4a 24f ec5 c12 nick/master 4ea df7 2fb jess/master a09 c63 b3b master public/master
  • 279. ce0 4a7 5ec ce0 4a7 5ec developer developer e4a e4a nick jessica 24f ec5 c12 4ea df7 2fb a09 ce0 4a7 5ec ce0 4a7 5ec ce0 4a7 5ec nickh/ schacon/ jessica/ e4a e4a e4a project project project 24f ec5 c12 24f ec5 c12 4ea df7 2fb "nick" "public" 4ea df7 2fb "jess" a09 a09 c63 b3b ce0 4a7 5ec my repo e4a 24f ec5 c12 nick/master 4ea df7 2fb jess/master a09 c63 b3b master public/master
  • 282. developer developer developer developer shared repository developer developer developer developer
  • 283. shared repository developer developer developer git clone
  • 284. shared repository developer developer developer git push
  • 285. shared repository developer developer developer git push
  • 286. shared repository developer developer developer
  • 287. shared repository developer developer developer git fetch git merge
  • 288. shared repository developer developer developer git push
  • 290. dictator blessed repository lieutenant lieutenant developer developer developer developer
  • 291. dictator blessed repository lieutenant lieutenant developer developer developer developer git clone
  • 292. dictator blessed repository lieutenant lieutenant developer developer developer developer git fetch git merge
  • 293. dictator blessed repository lieutenant lieutenant developer developer developer developer git fetch git merge
  • 294. git fetch; git merge dictator blessed repository lieutenant lieutenant developer developer developer developer
  • 295. git push dictator blessed repository lieutenant lieutenant developer developer developer developer
  • 296. dictator blessed repository lieutenant lieutenant developer developer developer developer git fetch
  • 298. blessed repository developer developer public public integration developer developer manager private private
  • 299. github.com /schacon/ticgit blessed /yob/ticgit /pope/ticgit repository developer developer public public integration developer developer manager private private
  • 300. github.com /schacon/ticgit “forks” blessed /yob/ticgit /pope/ticgit repository developer developer public public integration developer developer manager private private
  • 301. blessed repository developer developer public public integration developer developer manager private private git push
  • 302. blessed repository developer developer public public integration developer developer manager private private git clone
  • 303. blessed repository developer developer public public integration developer developer manager private private git push
  • 304. blessed repository developer developer public public integration developer developer manager private private git fetch git merge
  • 305. blessed repository developer developer public public integration developer developer manager private private git push
  • 306. blessed repository developer developer public public integration developer developer manager private private git fetch git merge
  • 307. blessed repository developer developer public public integration developer developer manager private private git push
  • 309. scott jessica default C1 C0
  • 310. scott jessica default scott/default default C1 C1 C0 C0
  • 311. scott jessica default git clone scott/default default C1 C1 C0 C0
  • 312. scott jessica default scott/default default C1 C1 C0 C0
  • 313. scott jessica default scott/default default C1 C1 C0 C0
  • 314. scott jessica default C4 C3 default scott/default C2 C1 C1 C0 C0
  • 315. scott jessica default C4 C3 default scott/default C2 C1 C1 C0 C0
  • 316. scott jessica default C4 C3 default scott/default C2 C1 C1 C0 C0
  • 317. scott jessica default default C7 C4 C6 C3 C5 scott/default C2 C1 C1 C0 C0
  • 318. scott jessica default default C7 C4 C6 C3 C5 scott/default C2 C1 C1 C0 C0
  • 319. scott jessica default scott/default default C7 C7 C4 C6 C6 C3 C5 C5 C2 C1 C1 C0 C0
  • 320. scott jessica default scott/default default experiment C7 C7 C4 C9 C6 C6 C3 C8 C5 C5 C2 C1 C1 C0 C0