Creating distributed development workflows using Git


                       Susan Potter

              Champaign-Urbana Developer’s Meetup



                      August 8, 2011
Scope of Talk


  • How does Git differ. . . ?
    CVS, Subversion, Perforce, Mercurial
Scope of Talk


  • How does Git differ. . . ?
    CVS, Subversion, Perforce, Mercurial



  • Gitting Started Locally
    Server configuration management
Scope of Talk


  • How does Git differ. . . ?
    CVS, Subversion, Perforce, Mercurial



  • Gitting Started Locally
    Server configuration management



  • Centralized Remote
    (a.k.a. a better Subversion)
Scope of Talk


  • How does Git differ. . . ?             • Forking Workflows
    CVS, Subversion, Perforce, Mercurial    (the GitHub model)



  • Gitting Started Locally
    Server configuration management



  • Centralized Remote
    (a.k.a. a better Subversion)
Scope of Talk


  • How does Git differ. . . ?             • Forking Workflows
    CVS, Subversion, Perforce, Mercurial    (the GitHub model)



  • Gitting Started Locally                • Gatekeeper Workflows
    Server configuration management          (enterprise release management)



  • Centralized Remote
    (a.k.a. a better Subversion)
Scope of Talk


  • How does Git differ. . . ?             • Forking Workflows
    CVS, Subversion, Perforce, Mercurial     (the GitHub model)



  • Gitting Started Locally                • Gatekeeper Workflows
    Server configuration management           (enterprise release management)



  • Centralized Remote                     • Deployment Strategies?
    (a.k.a. a better Subversion)             (scalable distributed deployment)
VCS Dimensions



                Delta                       DAG

  Local         RCS                         cp -r or hard links

  Centralized   CVS, Subversion, Perforce   ?

  Distributed   Mercurial, Darcs            Git, Bazaar
Gitting Started Locally (1/4)


   Initializing local repo inside working directory
Gitting Started Locally (1/4)


   Initializing local repo inside working directory
     • git init
Gitting Started Locally (1/4)


   Initializing local repo inside working directory
     • git init
     • git config user.email “user@domain”
Gitting Started Locally (1/4)


   Initializing local repo inside working directory
     • git init
     • git config user.email “user@domain”
     • git config user.name “Your Name”
Gitting Started Locally (2/4)


           $GIT_DIR => .git/
Gitting Started Locally (2/4)


           $GIT_DIR => .git/
            • branches
Gitting Started Locally (2/4)


           $GIT_DIR => .git/
            • branches
            • hooks
Gitting Started Locally (2/4)


           $GIT_DIR => .git/
            • branches
            • hooks
            • objects
Gitting Started Locally (2/4)


           $GIT_DIR => .git/
            • branches
            • hooks
            • objects
            • refs
Gitting Started Locally (2/4)


           $GIT_DIR => .git/
            • branches
            • hooks
            • objects
            • refs
            • config & info
Gitting Started Locally (3/4)


         $GIT_INDEX => .git/index
Gitting Started Locally (3/4)


         $GIT_INDEX => .git/index

          •   staging area
Gitting Started Locally (3/4)


         $GIT_INDEX => .git/index

          •   staging area
          •   add files before commit
Gitting Started Locally (3/4)


         $GIT_INDEX => .git/index

          •   staging area
          •   add files before commit
          •   can even add “patches”
Gitting Started Locally (4/4)




            DEMO
Centralized Workflow (1/3)

  Adding a remote
Centralized Workflow (1/3)

  Adding a remote
    • git init           bare
     Create remote “bare” repo
Centralized Workflow (1/3)

  Adding a remote
    • git init            bare
      Create remote “bare” repo

    • Setup server authN/authZ
      e.g. $HOME/.ssh/authorized_keys, PAM, LDAP, etc.
Centralized Workflow (1/3)

  Adding a remote
    • git init             bare
      Create remote “bare” repo

    • Setup server authN/authZ
      e.g. $HOME/.ssh/authorized_keys, PAM, LDAP, etc.

    • git remote add <name> <URL>
      Add remote to local repository
Centralized Workflow (2/3)


  Sharing to remote
Centralized Workflow (2/3)


  Sharing to remote
    • git pull <remove> <branch>
     Pull from <remote> <branch>
Centralized Workflow (2/3)


  Sharing to remote
    • git pull <remove> <branch>
     Pull from <remote> <branch>

    • git push <remote> <branch>
     Push to <remote> <branch>
Centralized Workflow (3/3)




           DEMO
           (with branching)
Forking Workflow (1/2)



  Forking remote repository. . .
Forking Workflow (1/2)



  Forking remote repository. . .
   • cp -r <orig.repo> <forked.repo>
     Basically just a straight copy is necessary
Forking Workflow (2/2)




           DEMO
Gatekeeper Workflow (1/2)



  Gatekeeper remote repository. . .
Gatekeeper Workflow (1/2)



  Gatekeeper remote repository. . .
   • git init             bare
     Basically just create a bare Git repo and let gatekeeper curate and selectively push
Gatekeeper Workflow (2/2)




          DEMO
Deployment Workflows (1/2)

  Distributed systems deployment could bundle
  rollback with new release. . .
Deployment Workflows (1/2)

  Distributed systems deployment could bundle
  rollback with new release. . .
   • git bundle create <file.bundle>
     <branches,tags,etc>
     Creating a bundle with those branches, tags and/or commit range
Deployment Workflows (1/2)

  Distributed systems deployment could bundle
  rollback with new release. . .
   • git bundle create <file.bundle>
     <branches,tags,etc>
     Creating a bundle with those branches, tags and/or commit range

   • git bundle verify <file.bundle>
     Verify bundle is valid and will apply cleanly to deployed repository
Deployment Workflows (1/2)

  Distributed systems deployment could bundle
  rollback with new release. . .
   • git bundle create <file.bundle>
     <branches,tags,etc>
     Creating a bundle with those branches, tags and/or commit range

   • git bundle verify <file.bundle>
     Verify bundle is valid and will apply cleanly to deployed repository

   • git bundle unbundle <file.bundle>
     Unbundling subset of repository on deployment node
Deployment Workflows (2/2)




          DEMO
Resources (1/2)



   • http://git-scm.org
   • http://github.com

   • Pro Git by Scott Chacon
Questions?




         Figure:   http://www.flickr.com/photos/42682395@N04/
Questions?




         Figure:   http://www.flickr.com/photos/42682395@N04/




         @SusanPotter

Distributed Developer Workflows using Git

  • 1.
    Creating distributed developmentworkflows using Git Susan Potter Champaign-Urbana Developer’s Meetup August 8, 2011
  • 2.
    Scope of Talk • How does Git differ. . . ? CVS, Subversion, Perforce, Mercurial
  • 3.
    Scope of Talk • How does Git differ. . . ? CVS, Subversion, Perforce, Mercurial • Gitting Started Locally Server configuration management
  • 4.
    Scope of Talk • How does Git differ. . . ? CVS, Subversion, Perforce, Mercurial • Gitting Started Locally Server configuration management • Centralized Remote (a.k.a. a better Subversion)
  • 5.
    Scope of Talk • How does Git differ. . . ? • Forking Workflows CVS, Subversion, Perforce, Mercurial (the GitHub model) • Gitting Started Locally Server configuration management • Centralized Remote (a.k.a. a better Subversion)
  • 6.
    Scope of Talk • How does Git differ. . . ? • Forking Workflows CVS, Subversion, Perforce, Mercurial (the GitHub model) • Gitting Started Locally • Gatekeeper Workflows Server configuration management (enterprise release management) • Centralized Remote (a.k.a. a better Subversion)
  • 7.
    Scope of Talk • How does Git differ. . . ? • Forking Workflows CVS, Subversion, Perforce, Mercurial (the GitHub model) • Gitting Started Locally • Gatekeeper Workflows Server configuration management (enterprise release management) • Centralized Remote • Deployment Strategies? (a.k.a. a better Subversion) (scalable distributed deployment)
  • 8.
    VCS Dimensions Delta DAG Local RCS cp -r or hard links Centralized CVS, Subversion, Perforce ? Distributed Mercurial, Darcs Git, Bazaar
  • 9.
    Gitting Started Locally(1/4) Initializing local repo inside working directory
  • 10.
    Gitting Started Locally(1/4) Initializing local repo inside working directory • git init
  • 11.
    Gitting Started Locally(1/4) Initializing local repo inside working directory • git init • git config user.email “user@domain”
  • 12.
    Gitting Started Locally(1/4) Initializing local repo inside working directory • git init • git config user.email “user@domain” • git config user.name “Your Name”
  • 13.
    Gitting Started Locally(2/4) $GIT_DIR => .git/
  • 14.
    Gitting Started Locally(2/4) $GIT_DIR => .git/ • branches
  • 15.
    Gitting Started Locally(2/4) $GIT_DIR => .git/ • branches • hooks
  • 16.
    Gitting Started Locally(2/4) $GIT_DIR => .git/ • branches • hooks • objects
  • 17.
    Gitting Started Locally(2/4) $GIT_DIR => .git/ • branches • hooks • objects • refs
  • 18.
    Gitting Started Locally(2/4) $GIT_DIR => .git/ • branches • hooks • objects • refs • config & info
  • 19.
    Gitting Started Locally(3/4) $GIT_INDEX => .git/index
  • 20.
    Gitting Started Locally(3/4) $GIT_INDEX => .git/index • staging area
  • 21.
    Gitting Started Locally(3/4) $GIT_INDEX => .git/index • staging area • add files before commit
  • 22.
    Gitting Started Locally(3/4) $GIT_INDEX => .git/index • staging area • add files before commit • can even add “patches”
  • 23.
  • 24.
  • 25.
    Centralized Workflow (1/3) Adding a remote • git init bare Create remote “bare” repo
  • 26.
    Centralized Workflow (1/3) Adding a remote • git init bare Create remote “bare” repo • Setup server authN/authZ e.g. $HOME/.ssh/authorized_keys, PAM, LDAP, etc.
  • 27.
    Centralized Workflow (1/3) Adding a remote • git init bare Create remote “bare” repo • Setup server authN/authZ e.g. $HOME/.ssh/authorized_keys, PAM, LDAP, etc. • git remote add <name> <URL> Add remote to local repository
  • 28.
  • 29.
    Centralized Workflow (2/3) Sharing to remote • git pull <remove> <branch> Pull from <remote> <branch>
  • 30.
    Centralized Workflow (2/3) Sharing to remote • git pull <remove> <branch> Pull from <remote> <branch> • git push <remote> <branch> Push to <remote> <branch>
  • 31.
    Centralized Workflow (3/3) DEMO (with branching)
  • 32.
    Forking Workflow (1/2) Forking remote repository. . .
  • 33.
    Forking Workflow (1/2) Forking remote repository. . . • cp -r <orig.repo> <forked.repo> Basically just a straight copy is necessary
  • 34.
  • 35.
    Gatekeeper Workflow (1/2) Gatekeeper remote repository. . .
  • 36.
    Gatekeeper Workflow (1/2) Gatekeeper remote repository. . . • git init bare Basically just create a bare Git repo and let gatekeeper curate and selectively push
  • 37.
  • 38.
    Deployment Workflows (1/2) Distributed systems deployment could bundle rollback with new release. . .
  • 39.
    Deployment Workflows (1/2) Distributed systems deployment could bundle rollback with new release. . . • git bundle create <file.bundle> <branches,tags,etc> Creating a bundle with those branches, tags and/or commit range
  • 40.
    Deployment Workflows (1/2) Distributed systems deployment could bundle rollback with new release. . . • git bundle create <file.bundle> <branches,tags,etc> Creating a bundle with those branches, tags and/or commit range • git bundle verify <file.bundle> Verify bundle is valid and will apply cleanly to deployed repository
  • 41.
    Deployment Workflows (1/2) Distributed systems deployment could bundle rollback with new release. . . • git bundle create <file.bundle> <branches,tags,etc> Creating a bundle with those branches, tags and/or commit range • git bundle verify <file.bundle> Verify bundle is valid and will apply cleanly to deployed repository • git bundle unbundle <file.bundle> Unbundling subset of repository on deployment node
  • 42.
  • 43.
    Resources (1/2) • http://git-scm.org • http://github.com • Pro Git by Scott Chacon
  • 44.
    Questions? Figure: http://www.flickr.com/photos/42682395@N04/
  • 45.
    Questions? Figure: http://www.flickr.com/photos/42682395@N04/ @SusanPotter