Intro to Git   Scott Chacon
What is Git?
Git is an open source,distributed version controlsystem designed for speed        and efficiency
Git is an open source,distributed version controlsystem 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
which meanseverything is fast
which means   everything is fastevery clone is a backup
which means   everything is fastevery clone is a backup     work offline
Git is an open source,distributed version control  system designed for speed and efficiency
Immutable
(almost) never removes data
Snapshots, not Patches
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
C1     C2   C3   C4   C5           file A    1         2 deltastorage           file B              1    2           file C  ...
How is this Different Than {cvs|svn|p4}?
Git Ist Schnell!
No Network Needed
No Network Needed     Performing a diff
No Network Needed     Performing a diff    Viewing file history
No Network Needed     Performing a diff    Viewing file history    Committing changes
No Network Needed     Performing a diff    Viewing file history    Committing changes     Merging branches
No Network Needed           Performing a diff         Viewing file history         Committing changes          Merging bran...
No Network Needed           Performing a diff         Viewing file history         Committing changes          Merging bran...
jQuery tests
Work Offline
No .svn Directories
Cheap Branching
$ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0....
$ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0....
$ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0....
$ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0....
$ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0....
$ time cp -Rf testrepo r2real	0m13.684suser	0m0.085ssys	 0m1.215s
Easy Merging
How Do I Use Git?
First Steps
$ git config --global user.name “Scott Chacon”$ git config --global user.email “schacon@gmail.com”
Getting A Repo
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.sampl...
$ tree -a.|-- .git|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |    |-- post-commit.sampl...
$ tree -a.|-- .git|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |    |-- post-commit.sampl...
git clone
$ git clone
$ git clone git://github.com/schacon/grit.git
$ git clone git://github.com/schacon/grit.git mygrit
$ git clone git://github.com/schacon/grit.git mygritInitialized empty Git repository in /home/schacon/mygrit/.git/remote: ...
$ git clone git://github.com/schacon/grit.git mygritInitialized empty Git repository in /home/schacon/mygrit/.git/remote: ...
$ git clone git://github.com/schacon/grit.git mygritInitialized empty Git repository in /home/schacon/mygrit/.git/remote: ...
The Git Directory
git init
$ tree -a.|-- .git|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |    |-- post-commit.sampl...
$ tree -a.|-- .git|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |    |-- post-commit.sampl...
Areas of Interest
$ tree -a.|-- .git|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |    |-- post-commit.sampl...
/etc/gitconfig
/etc/gitconfig~/.gitconfig
/etc/gitconfig~/.gitconfig .git/config
$ tree -a.|-- .git|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |    |-- post-commit.sampl...
$ tree -a.|-- .git|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |    |-- post-commit.sampl...
$ tree -a.|-- .git|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |    |-- post-commit.sampl...
$   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|   |   ...
$ tree -a.|-- .git|   |-- COMMIT_EDITMSG|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |   ...
$ tree -a.|-- .git|   |-- COMMIT_EDITMSG|   |-- HEAD|   |-- branches|   |-- config|   |-- description|   |-- hooks|   |   ...
A Basic Workflow
A Basic Workflow     Edit files Stage the changesReview your changesCommit the changes
working directorygit add            index                       git commit          repository
a working copy      working directory                           of your projectgit add            index                   ...
working directory         git add                       index                                  git commitobject database  ...
working directorygit add            index          “staging”                       git commit          repository
A Basic Workflow     Edit files Stage the changesReview your changesCommit the changes
$ find ../app.yaml./index.yaml./main.py
$ find ../app.yaml./index.yaml./main.py
$ find ../app.yaml./index.yaml./main.py
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webappclass MainHandler(webapp.R...
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webappclass MainHandler(webapp.R...
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webappclass MainHandler(webapp.R...
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webapp# this program prints out ...
$ git status
$ git status# On branch master# Changed but not updated:#   (use "git add <file>..." to update what##	modified:   main.py#...
$ git status# On branch master# Changed but not updated:#   (use "git add <file>..." to update what##	modified:   main.py#...
$ git status# On branch master# Changed but not updated:#   (use "git add <file>..." to update what##	modified:   main.py#...
$ git status# On branch master# Changed but not updated:#   (use "git add <file>..." to update what##	modified:   main.py#...
$ git status# On branch master# Changed but not updated:#   (use "git add <file>..." to update what##	modified:   main.py#...
$ git status# On branch master# Changed but not updated:#   (use "git add <file>..." to update what##	modified:   main.py#...
$ git status# On branch master# Changed but not STAGED                   updated:#   (use "git add <file>..." to update wh...
$ git status# On branch master# Changed but not STAGED                   updated:#   (use "git add <file>..." to update wh...
A Basic Workflow     Edit files Stage the changesReview your changesCommit the changes
git add
working directorygit add            index                       git commit          repository
working directorygit add            index                       git commit          repository
$ git add main.py$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>.##	modified:   m...
$ git add main.py$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>.##	modified:   m...
$ git add main.py$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>.##	modified:   m...
$ git add main.py$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>.##	modified:   m...
$ git add main.py$ git status# On branch master# Changes to be committed:           THAT ARE STAGED#    (use "git reset HE...
$ vim app.yamlapplication: chaconversion: 1runtime: pythonapi_version: 1handlers:- url: .*  script: main.py~~~"app.yaml" 8...
$ vim app.yamlapplication: chaconversion: 1runtime: pythonapi_version: 1handlers:- url: .*  script: main.py~~~"app.yaml" 8...
$ vim app.yamlapplication: chaconversion: 1runtime: pythonapi_version: 1handlers:- url: .*  script: main.py~~~"app.yaml" 8...
$ vim app.yamlapplication: chaconversion: 1runtime: pythonapi_version: 1handlers:- url: .*  script: main.py~~~"app.yaml" 8...
$ vim app.yamlapplication: chaconversion: 2runtime: pythonapi_version: 1handlers:- url: .*  script: main.py~~~"app.yaml" 8...
$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to unstage)##	 modified:   ma...
$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to unstage)##	 modified:   ma...
$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to unstage)##	 modified:   ma...
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webapp# this program prints out ...
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webapp# this program prints out ...
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webapp# this program prints out ...
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webapp# this program prints out ...
$ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webapp# this program prints out ...
$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to unstage)##	 modified:   ma...
$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to unstage)##	 modified:   ma...
$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to unstage)##	 modified:   ma...
$ git status         # On branch master         # Changes to be committed:Staged   #    (use "git reset HEAD <file>..." to...
$ git status           # On branch master           # Changes to be committed:           #    (use "git reset HEAD <file>....
$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to unstage)##	 modified:    m...
Staged                             In Working Directory#!/usr/bin/env python                         #!/usr/bin/env python...
Staged                             In Working Directory#!/usr/bin/env python                         #!/usr/bin/env python...
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 ...
$ git add app.yaml main.py$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to ...
$ git add app.yaml main.py$ git status# On branch master# Changes to be committed:#    (use "git reset HEAD <file>..." to ...
A Basic Workflow     Edit files Stage the changesReview your changesCommit the changes
gitcommit
working directorygit add            index                       git commit          repository
working directorygit add            index                       git commit          repository
$ git commit# Please enter the commit message for your changes. Lines starting# with # will be ignored, and an empty messa...
$ git commit# Please enter the commit message for your changes. Lines starting# with # will be ignored, and an empty messa...
$ git commit# Please enter the commit message for your changes. Lines starting# with # will be ignored, and an empty messa...
$ git commitdescriptive commit message# Please enter the commit message for your changes. Lines starting# with # will be i...
$ git commitdescriptive commit message# Please enter the commit message for your changes. Lines starting# with # will be i...
$ git commitCreated 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 st...
A Basic Workflow     Edit files        vim / emacs / etc Stage the changes      git add (file)Review your changes     repo st...
A Basic Workflow     Edit files        vim / emacs / etc Stage the changes      git add (file)Review your changes     repo st...
A Basic Workflow     Edit files        vim / emacs / etc Stage the changes      git add (file)Review your changes       git s...
A Basic Workflow     Edit files        vim / emacs / etc Stage the changes      git add (file)Review your changes       git s...
cheating...
A Basicerer Workflow     Edit files       vim / emacs / etcCommit the changes      git commit
A Basicerer Workflow         Edit files           vim / emacs / etcStage & commit the changes    git commit -a
A Basicerer Workflow         Edit files           vim / emacs / etcStage & commit the changes    git commit -a
What’s going on here?
$ git commitCreated commit 77d3001: descriptive commit message 2 files changed, 4 insertions(+), 2 deletions(-)
$ git commitCreated commit 77d3001: descriptive commit message 2 files changed, 4 insertions(+), 2 deletions(-)
77d3001
77d3001
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
77d3001a1de6bf8f5e431972fe4d25b01e595c0b
77d3001a1de6bf8f5e431972fe4d25b01e595c0b                  ae668..               commit               size                 ...
77d3001a1de6bf8f5e431972fe4d25b01e595c0b                   ae668..                     commit        sizetree c4ec543b0322...
77d3001a1de6bf8f5e431972fe4d25b01e595c0b                  ae668..               commit               size                 ...
77d3001a1de6bf8f5e431972fe4d25b01e595c0b                  ae668..               commit                 size               ...
ae668..                              commit                 sizecommit               size  tree         2de54             ...
ae668..                                 commit                 sizecommit                    size  tree            2de54  ...
ae668..                                                                                                   commit          ...
ae668..                                                                                                   commit          ...
48e32a                                                                                                                    ...
Repository5b1   32a   c361d3   f46   3d4ffe   6fe   ae638d   23f   03e254   30e   5b1a14   67e   1d33d5   735   d23c4e   c...
Repository5b1   32a   c361d3   f46   3d4ffe   6fe   ae6                  git checkout ae63538d   23f   03e254   30e   5b1a...
Repository5b1   32a   c361d3   f46   3d4ffe   6fe   ae6                  git checkout ae63538d   23f   03e254   30e   5b1a...
Repository             Index               Working Directory5b1   32a   c36                  ./                3d4        ...
Repository             Index               Working Directory5b1   32a   c36                  ./                3d4        ...
Repository             Index               Working Directory5b1   32a   c36                  ./                3d4        ...
Repository             Index               Working Directory5b1   32a   c36                  ./                3d4        ...
Repository             Index               Working Directory5b1   32a   c36                  ./                3d4        ...
Repository             Index               Working Directory5b1   32a   c36                  ./                3d4        ...
Repository               Index               Working Directory5b1   32a   c36                    ./                3d4    ...
Repository             Index               Working Directory5b1   32a   c36                  ./                3d4        ...
Repository             Index               Working Directory5b1   32a   c36                  ./                3d4        ...
object model  commit   tree   blob           }   C1
object modelpointer to a       commit                            } snapshot                                C1directory lis...
object modelpointer to a       commit                            } snapshot                                C1directory lis...
Branching and Merging
branches
brancheslightweight, movablepointers to a commit      branch        C1
branching
git branch
git checkout
HEAD     default     master         experimentC0     C1               C2      C3
HEAD C4      default      master       experimentC3C0       C5        C1              C2      experiment      C3      git ...
HEAD C4      default      master       experimentC3C0       C5        C1              C2      experiment      C3      git ...
HEAD C4      default      master       experiment                           $ git branchC3C0       C5        C1           ...
HEAD C4      default      master       experiment                           $ git branchC3C0       C5        C1           ...
C4       default       master      experimentC3C0        C5         C1              C2      experiment      C3        HEAD...
T1          master               default               master              experiment                                     ...
T1          master               default               master              experiment                                     ...
T1          master               default               master              experiment                                     ...
T1          master           default           master               experiment                                         git...
HEAD                           T1           default           master               git checkout default                   ...
HEAD                           T1           default           master               git checkout default                   ...
git commit            T1              T1                            master       default                                  ...
git commit            T1              T1                            master       default                                  ...
git commit            T1              T1                            master       default                                  ...
T1         default                                          master  C0        C1             C4                 C2       C...
merging
git merge
T1         default                               masterC0   C1         C4          C2   C3           C5                   ...
HEAD                            T1         default                                       masterC0        C1            C4 ...
HEAD                             T1                master                                               default C0        ...
HEAD                             T1                master                                               default C0        ...
default C0      C1                C4                 C6            C8              C2      C3           C5                ...
defaultC0        C1             C4         C6             C8               C2   C3        C5             C7               ...
HEAD                                      defaultC0     C1                   C4         C6             C8            C2   ...
HEAD                                                   defaultC0     C1                   C4        C6            C8      ...
Hot3 Way Merge   Action
masterC0   C1         C4          C2   C3          C5                        experiment
masterC0   C1         C4          C2   C3          C5                        experiment
C0   C1             C4        C6          C2   C3        C5        C7
C0   C1             C4        C6          C2   C3        C5        C7
C0   C1             C4        C6          C2   C3        C5        C7
Remotes
Distributed Workflow
local repo           public repo                public repointernet                         local repo                    ...
local repo               public repo                 public repo           A   B   Cinternet                   git push   ...
local repo                   git fetch   A   B    C                     (git)               public repo                  p...
local repo                   git fetch   A   B    C                     (git)     D   E    F   git commit               pu...
local repo                   git fetch   A   B    C   git push                     (git)     D   E    F    (ssh)          ...
local repo                   git fetch   A   B    C   git push                     (git)     D   E    F    (ssh)          ...
local repo                   git fetch   A   B    C   git push                     (git)     D   E    F    (ssh)          ...
Multiple Remotes
developer                               developer  nick                                   jessica                      ce0...
developer                               developer  nick                                   jessica                         ...
developer                                developer  nick                                    jessica                       ...
developer                                developer  nick                                    jessica                      b...
developer                                       developer  nick                                           jessica         ...
ce0   4a7   5ecdeveloper                                                  developer            e4a  nick                  ...
ce0   4a7   5ecdeveloper                                                  developer            e4a  nick                  ...
ce0   4a7   5ec                                                 ce0   4a7   5ecdeveloper                                  ...
ce0   4a7   5ec                                                 ce0   4a7   5ecdeveloper                                  ...
ce0   4a7   5ec                                                ce0   4a7   5ecdeveloper                                   ...
ce0   4a7   5ec                                                ce0   4a7   5ecdeveloper                                   ...
ce0   4a7   5ec                                                ce0   4a7   5ecdeveloper                                   ...
ce0   4a7   5ec                                                ce0   4a7   5ecdeveloper                                   ...
ce0   4a7   5ec                                                 ce0   4a7   5ecdeveloper                                  ...
5ec                ce0   4a7   5ec                   ce0   4a7   5ec      schacon/                        jessica/        ...
ce0   4a7   5ec                                                 ce0   4a7   5ecdeveloper                                  ...
ce0   4a7   5ec                                                ce0   4a7   5ecdeveloper                                   ...
nickh/                      schacon/                            jessic                                          e4a       ...
ce0             ce0   4a7                   4a7   5ec                         5ec                                         ...
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Basic gittalk
Upcoming SlideShare
Loading in …5
×

Basic gittalk

549 views
508 views

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
549
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
31
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • the index is a cache that sits in-between your temporary working directory and your permanent repository\n
  • the index is a cache that sits in-between your temporary working directory and your permanent repository\n
  • the index is a cache that sits in-between your temporary working directory and your permanent repository\n
  • the index is a cache that sits in-between your temporary working directory and your permanent repository\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • the index is a cache that sits in-between your temporary working directory and your permanent repository\n
  • when you run &amp;#x2018;git add&amp;#x2019; on files, it caches the snapshot of those versions of the files in the index\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • when you run &amp;#x2018;git add&amp;#x2019; on files, it caches the snapshot of those versions of the files in the index\n
  • then when you run &amp;#x2018;git commit&amp;#x2019;, it actually writes the commit object pointing not to the versions of the files in your working directory, but what they looked like when you &amp;#x2018;git added&amp;#x2019; them\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • which gives us a directed acyclic graph like this\n
  • which gives us a directed acyclic graph like this\n
  • \n
  • references are lightweight, easily movable pointers to a commit that signifies the head of a local or remote branch\n
  • references are lightweight, easily movable pointers to a commit that signifies the head of a local or remote branch\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • think of it more like this. in source control, you have systems that store file versions as deltas, and those that store them as a DAG\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Basic gittalk

    1. 1. Intro to Git Scott Chacon
    2. 2. What is Git?
    3. 3. Git is an open source,distributed version controlsystem designed for speed and efficiency
    4. 4. Git is an open source,distributed version controlsystem designed for speed and efficiency
    5. 5. git-scm.com
    6. 6. Git is an open source,distributed version control system designed for speed and efficiency
    7. 7. Fully Distributed
    8. 8. (almost) everything is local
    9. 9. which means
    10. 10. which meanseverything is fast
    11. 11. which means everything is fastevery clone is a backup
    12. 12. which means everything is fastevery clone is a backup work offline
    13. 13. Git is an open source,distributed version control system designed for speed and efficiency
    14. 14. Immutable
    15. 15. (almost) never removes data
    16. 16. Snapshots, not Patches
    17. 17. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    18. 18. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    19. 19. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    20. 20. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    21. 21. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    22. 22. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    23. 23. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    24. 24. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    25. 25. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    26. 26. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    27. 27. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    28. 28. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    29. 29. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    30. 30. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    31. 31. C1 C2 C3 C4 C5 file A 1 2 deltastorage file B 1 2 file C 1 2 3 C1 C2 C3 C4 C5snapshot A A1 A1 A2 A2 storage B B B B1 B2 C C1 C2 C2 C3
    32. 32. How is this Different Than {cvs|svn|p4}?
    33. 33. Git Ist Schnell!
    34. 34. No Network Needed
    35. 35. No Network Needed Performing a diff
    36. 36. No Network Needed Performing a diff Viewing file history
    37. 37. No Network Needed Performing a diff Viewing file history Committing changes
    38. 38. No Network Needed Performing a diff Viewing file history Committing changes Merging branches
    39. 39. No Network Needed Performing a diff Viewing file history Committing changes Merging branches Obtaining any other revision of a file
    40. 40. No Network Needed Performing a diff Viewing file history Committing changes Merging branches Obtaining any other revision of a file Switching branches
    41. 41. jQuery tests
    42. 42. Work Offline
    43. 43. No .svn Directories
    44. 44. Cheap Branching
    45. 45. $ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0.091suser 0m0.016ssys 0m0.023s
    46. 46. $ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0.091suser 0m0.016ssys 0m0.023s
    47. 47. $ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0.091suser 0m0.016ssys 0m0.023s
    48. 48. $ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0.091suser 0m0.016ssys 0m0.023s
    49. 49. $ du -h testrepo/ 78M testrepo/$ cd testrepo/$ time git checkout -b newbranchSwitched to a new branch "newbranch"real 0m0.091suser 0m0.016ssys 0m0.023s
    50. 50. $ time cp -Rf testrepo r2real 0m13.684suser 0m0.085ssys 0m1.215s
    51. 51. Easy Merging
    52. 52. How Do I Use Git?
    53. 53. First Steps
    54. 54. $ git config --global user.name “Scott Chacon”$ git config --global user.email “schacon@gmail.com”
    55. 55. Getting A Repo
    56. 56. git init
    57. 57. $ touch hello_world.rb$ git init$ git add .$ git commit -m ‘first commit’
    58. 58. $ touch hello_world.rb$ git init$ git add .$ git commit -m ‘first commit’
    59. 59. $ 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.rb11 directories, 25 files
    60. 60. $ 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.rb11 directories, 25 files
    61. 61. $ 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.rb11 directories, 25 files
    62. 62. git clone
    63. 63. $ git clone
    64. 64. $ git clone git://github.com/schacon/grit.git
    65. 65. $ git clone git://github.com/schacon/grit.git mygrit
    66. 66. $ git clone git://github.com/schacon/grit.git mygritInitialized empty Git repository in /home/schacon/mygrit/.git/remote: Counting objects: 3220, done.remote: Compressing objects: 100% (2093/2093), done.remote: Total 3220 (delta 1134), reused 3149 (delta 1081)Receiving objects: 100% (3220/3220), 1.79 MiB | 357 KiB/s, done.Resolving deltas: 100% (1134/1134), done.
    67. 67. $ git clone git://github.com/schacon/grit.git mygritInitialized empty Git repository in /home/schacon/mygrit/.git/remote: Counting objects: 3220, done.remote: Compressing objects: 100% (2093/2093), done.remote: Total 3220 (delta 1134), reused 3149 (delta 1081)Receiving objects: 100% (3220/3220), 1.79 MiB | 357 KiB/s, done.Resolving deltas: 100% (1134/1134), done.$ cd mygrit$
    68. 68. $ git clone git://github.com/schacon/grit.git mygritInitialized empty Git repository in /home/schacon/mygrit/.git/remote: Counting objects: 3220, done.remote: Compressing objects: 100% (2093/2093), done.remote: Total 3220 (delta 1134), reused 3149 (delta 1081)Receiving objects: 100% (3220/3220), 1.79 MiB | 357 KiB/s, done.Resolving deltas: 100% (1134/1134), done.$ cd mygrit$ lsAPI.txt Manifest.txt README.txt benchmarks.rb examples libHistory.txt PURE_TODO Rakefile benchmarks.txt grit.gemspec test$
    69. 69. The Git Directory
    70. 70. git init
    71. 71. $ 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.rb11 directories, 25 files
    72. 72. $ 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.rb11 directories, 25 files
    73. 73. Areas of Interest
    74. 74. $ 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.rb11 directories, 25 files
    75. 75. /etc/gitconfig
    76. 76. /etc/gitconfig~/.gitconfig
    77. 77. /etc/gitconfig~/.gitconfig .git/config
    78. 78. $ 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.rb11 directories, 25 files
    79. 79. $ 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.rb11 directories, 25 files
    80. 80. $ 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.rb11 directories, 25 files
    81. 81. $ touch hello_world.rb$ git init$ git add .$ git commit -m ‘first commit’
    82. 82. $ touch hello_world.rb$ git init$ git add .$ git commit -m ‘first commit’
    83. 83. $ 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.rb17 directories, 33 files
    84. 84. $ 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.rb17 directories, 33 files
    85. 85. $ 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.rb17 directories, 33 files
    86. 86. A Basic Workflow
    87. 87. A Basic Workflow Edit files Stage the changesReview your changesCommit the changes
    88. 88. working directorygit add index git commit repository
    89. 89. a working copy working directory of your projectgit add index git commit repository
    90. 90. working directory git add index git commitobject database repository
    91. 91. working directorygit add index “staging” git commit repository
    92. 92. A Basic Workflow Edit files Stage the changesReview your changesCommit the changes
    93. 93. $ find ../app.yaml./index.yaml./main.py
    94. 94. $ find ../app.yaml./index.yaml./main.py
    95. 95. $ find ../app.yaml./index.yaml./main.py
    96. 96. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webappclass 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
    97. 97. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webappclass 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
    98. 98. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom google.appengine.ext import webappclass 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
    99. 99. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom 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
    100. 100. $ git status
    101. 101. $ 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
    102. 102. $ 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
    103. 103. $ 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
    104. 104. $ 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
    105. 105. $ 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
    106. 106. $ 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
    107. 107. $ 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
    108. 108. $ 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
    109. 109. A Basic Workflow Edit files Stage the changesReview your changesCommit the changes
    110. 110. git add
    111. 111. working directorygit add index git commit repository
    112. 112. working directorygit add index git commit repository
    113. 113. $ git add main.py$ git status# On branch master# Changes to be committed:# (use "git reset HEAD <file>.## modified: main.py#
    114. 114. $ git add main.py$ git status# On branch master# Changes to be committed:# (use "git reset HEAD <file>.## modified: main.py#
    115. 115. $ git add main.py$ git status# On branch master# Changes to be committed:# (use "git reset HEAD <file>.## modified: main.py#
    116. 116. $ git add main.py$ git status# On branch master# Changes to be committed:# (use "git reset HEAD <file>.## modified: main.py#
    117. 117. $ git add main.py$ git status# On branch master# Changes to be committed: THAT ARE STAGED# (use "git reset HEAD <file>.## modified: main.py#
    118. 118. $ vim app.yamlapplication: chaconversion: 1runtime: pythonapi_version: 1handlers:- url: .* script: main.py~~~"app.yaml" 8L, 101C
    119. 119. $ vim app.yamlapplication: chaconversion: 1runtime: pythonapi_version: 1handlers:- url: .* script: main.py~~~"app.yaml" 8L, 101C
    120. 120. $ vim app.yamlapplication: chaconversion: 1runtime: pythonapi_version: 1handlers:- url: .* script: main.py~~~"app.yaml" 8L, 101C
    121. 121. $ vim app.yamlapplication: chaconversion: 1runtime: pythonapi_version: 1handlers:- url: .* script: main.py~~~"app.yaml" 8L, 101C
    122. 122. $ vim app.yamlapplication: chaconversion: 2runtime: pythonapi_version: 1handlers:- url: .* script: main.py~~~"app.yaml" 8L, 101C
    123. 123. $ 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#
    124. 124. $ 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#
    125. 125. $ 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#
    126. 126. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom 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
    127. 127. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom 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
    128. 128. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom 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
    129. 129. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom 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
    130. 130. $ vim main.py#!/usr/bin/env pythonimport wsgiref.handlersfrom 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
    131. 131. $ 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#
    132. 132. $ 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#
    133. 133. $ 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#
    134. 134. $ 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 #
    135. 135. $ 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 #
    136. 136. $ 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#
    137. 137. Staged In Working Directory#!/usr/bin/env python #!/usr/bin/env pythonimport wsgiref.handlers import wsgiref.handlersfrom 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 = application =webapp.WSGIApplication([(/ webapp.WSGIApplication([(/debug=True) debug=True)wsgiref.handlers.CGIHandler().run(applicat wsgiref.handlers.CGIHandler().run(applicatif __name__ == __main__: if __name__ == __main__: main() main()
    138. 138. Staged In Working Directory#!/usr/bin/env python #!/usr/bin/env pythonimport wsgiref.handlers import wsgiref.handlersfrom 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 = application =webapp.WSGIApplication([(/ webapp.WSGIApplication([(/debug=True) debug=True)wsgiref.handlers.CGIHandler().run(applicat wsgiref.handlers.CGIHandler().run(applicatif __name__ == __main__: if __name__ == __main__: main() main()
    139. 139. You have to stage a file after you edit it
    140. 140. You have to stage a file after you edit it
    141. 141. You have to stage a file after you edit it
    142. 142. $ 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#
    143. 143. $ 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#
    144. 144. $ 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#
    145. 145. A Basic Workflow Edit files Stage the changesReview your changesCommit the changes
    146. 146. gitcommit
    147. 147. working directorygit add index git commit repository
    148. 148. working directorygit add index git commit repository
    149. 149. $ 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
    150. 150. $ 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
    151. 151. $ 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
    152. 152. $ git commitdescriptive 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
    153. 153. $ git commitdescriptive 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
    154. 154. $ git commitCreated commit 77d3001: descriptive commit message 2 files changed, 4 insertions(+), 2 deletions(-)
    155. 155. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file)Review your changes repo statusCommit the changes git commit
    156. 156. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file)Review your changes repo statusCommit the changes git commit
    157. 157. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file)Review your changes repo statusCommit the changes git commit
    158. 158. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file)Review your changes git statusCommit the changes git commit
    159. 159. A Basic Workflow Edit files vim / emacs / etc Stage the changes git add (file)Review your changes git statusCommit the changes git commit
    160. 160. cheating...
    161. 161. A Basicerer Workflow Edit files vim / emacs / etcCommit the changes git commit
    162. 162. A Basicerer Workflow Edit files vim / emacs / etcStage & commit the changes git commit -a
    163. 163. A Basicerer Workflow Edit files vim / emacs / etcStage & commit the changes git commit -a
    164. 164. What’s going on here?
    165. 165. $ git commitCreated commit 77d3001: descriptive commit message 2 files changed, 4 insertions(+), 2 deletions(-)
    166. 166. $ git commitCreated commit 77d3001: descriptive commit message 2 files changed, 4 insertions(+), 2 deletions(-)
    167. 167. 77d3001
    168. 168. 77d3001
    169. 169. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b
    170. 170. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b
    171. 171. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b
    172. 172. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b ae668.. commit size tree c4ec5 parent a149e author Scott committer Scott my commit message goes here and it is really, really cool
    173. 173. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b ae668.. commit sizetree c4ec543b0322744e55c5efc9b6c4e449d398dbffparent a149e2160b3f7573768cdc2fce24d0881f3577e1 tree c4ec5author Scott Chacon <schacon@gmail.com> 1223402504 -0700committer Scott Chaconparent <schacon@gmail.com> 1223402504 -0700 a149e author Scottdescriptive commit message committer Scott my commit message goes here and it is really, really cool
    174. 174. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b ae668.. commit size tree c4ec5 parent a149e author Scott committer Scott my commit message goes here and it is really, really cool
    175. 175. 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
    176. 176. ae668.. commit sizecommit size tree 2de54 tree c4ec5 parent 38def parent a149e author Scott author Scottcommitter Scottthis is the previous commit committer Scottand 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
    177. 177. ae668.. commit sizecommit size tree 2de54 tree c4ec5 parent 38def parent a149e author Scott author Scottcommitter Scottthis is the previous commit committer Scottand 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
    178. 178. ae668.. commit size commit sizecommit size commit size tree 2de54 tree c4ec5 tree 2fe65 tree parent author 2fe65 90ecd parent 90ecd parent 38def parent a149e Scott author Scott author authorcommitter Scott committer Scottthis is the commit before thatand Im not sure why Scott Scott this is the commit before that and Im 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
    179. 179. ae668.. commit size commit sizecommit 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 authorcommitter Scott committer Scottthis is the commit before thatand Im not sure why Scott Scott this is the commit before that and Im 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
    180. 180. 48e32a ae668.. f4623f 30e commit size 67e commit size commit size tree tree c4ec5c4e commit size tree 2fe65 2de54 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 Im not sure why Scott Scott this is the commit before that and Im not sure why committer Scott 3d5 1d3 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 a14 main.py 03e 03e index.yaml 1d3 ./ c4e main.py 03e app.yaml 3d5 38d 5b1 index.yaml 1d3 ./ c4e 77d main.py 03e app.yaml 3d5 index.yaml 1d3 main.py 03e
    181. 181. Repository5b1 32a c361d3 f46 3d4ffe 6fe ae638d 23f 03e254 30e 5b1a14 67e 1d33d5 735 d23c4e c4e 48e77d de3 2d3
    182. 182. Repository5b1 32a c361d3 f46 3d4ffe 6fe ae6 git checkout ae63538d 23f 03e254 30e 5b1a14 67e 1d33d5 735 d23c4e c4e 48e77d de3 2d3
    183. 183. Repository5b1 32a c361d3 f46 3d4ffe 6fe ae6 git checkout ae63538d 23f 03e254 30e 5b1a14 67e 1d33d5 735 d23c4e c4e 48e77d de3 2d3
    184. 184. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 Rakefile38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d3
    185. 185. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 Rakefile38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d3
    186. 186. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 Rakefile38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d3
    187. 187. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 Rakefile38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d3
    188. 188. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 Rakefile38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d3 git add
    189. 189. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 Rakefile 34f38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d3 git add
    190. 190. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 34f Rakefile38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d334f 3da a08ae9 git commit
    191. 191. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 34f Rakefile38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d334f 3da a08ae9
    192. 192. Repository Index Working Directory5b1 32a c36 ./ 3d4 ./1d3 f46 3d4ffe 6fe ae6 ./Rakefile 1d3 34f Rakefile38d 23f 03e ./README 03e README254 30e 5b1a14 67e 1d3 ./lib/ c36 lib/3d5 735 d23c4e c4e 48e ./lib/simplegit.rb 5b1 simplegit.rb77d de3 2d334f 3da a08ae9
    193. 193. object model commit tree blob } C1
    194. 194. object modelpointer to a commit } snapshot C1directory list treefile contents blob
    195. 195. object modelpointer to a commit } snapshot C1directory list treefile contents blob
    196. 196. Branching and Merging
    197. 197. branches
    198. 198. brancheslightweight, movablepointers to a commit branch C1
    199. 199. branching
    200. 200. git branch
    201. 201. git checkout
    202. 202. HEAD default master experimentC0 C1 C2 C3
    203. 203. HEAD C4 default master experimentC3C0 C5 C1 C2 experiment C3 git branch experiment
    204. 204. HEAD C4 default master experimentC3C0 C5 C1 C2 experiment C3 git branch experiment
    205. 205. HEAD C4 default master experiment $ git branchC3C0 C5 C1 * default experiment C2 experiment C3
    206. 206. HEAD C4 default master experiment $ git branchC3C0 C5 C1 * default experiment C2 experiment C3
    207. 207. C4 default master experimentC3C0 C5 C1 C2 experiment C3 HEAD git checkout experiment
    208. 208. T1 master default master experiment git commit C0 C4 C12 C3 C5 C2 C3 experiment HEAD
    209. 209. T1 master default master experiment git commit C0 C4 C12 C3 C5 C2 C3 experiment HEAD
    210. 210. T1 master default master experiment git commit C0 C4 C12 C3 C5 C2 C3 experiment HEAD
    211. 211. T1 master default master experiment git commitC1 C0 C1 C4 git commit C2 C3 C2 C5 C3 experiment HEAD
    212. 212. HEAD T1 default master git checkout default master experimentC1 C0 C1 C4 C2 C3 C2 C5 C3 experiment
    213. 213. HEAD T1 default master git checkout default master experimentC1 C0 C1 C4 C2 C3 C2 C5 C3 experiment
    214. 214. git commit T1 T1 master default master HEADC1C0 C1 C4 C4 C2 C3 C2 C5 C3 C5 experiment experiment
    215. 215. git commit T1 T1 master default master HEADC1C0 C1 C4 C4 C2 C3 C2 C5 C3 C5 experiment experiment
    216. 216. git commit T1 T1 master default master HEADC1C0 C1 C4 C4 C2 C3 C2 C5 C3 C5 experiment experiment
    217. 217. T1 default master C0 C1 C4 C2 C3 C5git checkout experiment experiment git commit HEAD
    218. 218. merging
    219. 219. git merge
    220. 220. T1 default masterC0 C1 C4 C2 C3 C5 experiment HEAD
    221. 221. HEAD T1 default masterC0 C1 C4 C2 C3 C5git checkout default experiment
    222. 222. HEAD T1 master default C0 C1 C4 C6 C2 C3 C5 git checkout default experimentgit merge experiment
    223. 223. HEAD T1 master default C0 C1 C4 C6 C2 C3 C5 git checkout default experimentgit merge experiment
    224. 224. default C0 C1 C4 C6 C8 C2 C3 C5 C7 experimentgit checkout experiment HEAD
    225. 225. defaultC0 C1 C4 C6 C8 C2 C3 C5 C7 experiment git commit HEAD
    226. 226. HEAD defaultC0 C1 C4 C6 C8 C2 C3 C5 C7 experimentgit checkout default
    227. 227. HEAD defaultC0 C1 C4 C6 C8 C2 C3 C5 C7 experimentgit merge experiment
    228. 228. Hot3 Way Merge Action
    229. 229. masterC0 C1 C4 C2 C3 C5 experiment
    230. 230. masterC0 C1 C4 C2 C3 C5 experiment
    231. 231. C0 C1 C4 C6 C2 C3 C5 C7
    232. 232. C0 C1 C4 C6 C2 C3 C5 C7
    233. 233. C0 C1 C4 C6 C2 C3 C5 C7
    234. 234. Remotes
    235. 235. Distributed Workflow
    236. 236. local repo public repo public repointernet local repo A B C
    237. 237. local repo public repo public repo A B Cinternet git push (ssh) local repo A B C
    238. 238. local repo git fetch A B C (git) public repo public repo A B Cinternet git push (ssh) local repo A B C
    239. 239. local repo git fetch A B C (git) D E F git commit public repo public repo A B Cinternet git push (ssh) local repo A B C
    240. 240. local repo git fetch A B C git push (git) D E F (ssh) public repo public repo A B C A B Cinternet D E F git push (ssh) local repo A B C
    241. 241. local repo git fetch A B C git push (git) D E F (ssh) public repo public repo A B C A B Cinternet D E F git push git fetch (ssh) (http) local repo A B C D E F
    242. 242. local repo git fetch A B C git push (git) D E F (ssh) public repo public repo A B C A B Cinternet D E F D E F git push git fetch (ssh) (http) local repo A B C D E F
    243. 243. Multiple Remotes
    244. 244. developer developer nick jessica ce0 4a7 5ec master my repo e4a
    245. 245. developer developer nick jessica commit ce0 4a7 5ec master my repo e4a
    246. 246. developer developer nick jessica tree ce0 4a7 5ec master my repo e4a
    247. 247. developer developer nick jessica blobs ce0 4a7 5ec master my repo e4a
    248. 248. developer developer nick jessica ce0 4a7 5ec schacon/ e4a project "public" git push public ce0 4a7 5ec master my repo e4a public/master
    249. 249. ce0 4a7 5ecdeveloper developer e4a nick jessica git clone (url) ce0 4a7 5ec schacon/ e4a project "public" ce0 4a7 5ec master my repo e4a public/master
    250. 250. ce0 4a7 5ecdeveloper 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
    251. 251. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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
    252. 252. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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
    253. 253. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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
    254. 254. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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/mastergit remote add nicknick git://github.com/nickh/project.git git remote add git://github.com/nickh/project.git
    255. 255. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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/mastergit remote add nicknick git://github.com/nickh/project.git git remote add git://github.com/nickh/project.git
    256. 256. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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/mastergit remote add add jess git://github.com/jessica/project.git git remote jess git://github.com/jessica/project.git
    257. 257. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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/mastergit remote add add jess git://github.com/jessica/project.git git remote jess git://github.com/jessica/project.git
    258. 258. 5ec ce0 4a7 5ec ce0 4a7 5ec schacon/ jessica/ e4a e4a project ce0 4a7 5ec project ce0 4a7 5ecc12 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
    259. 259. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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 master my repo e4a public/master public/master 24f ec5 c12 nick/master git fetch nick git remote add jess git://github.com/jessica/project.git git fetch nick
    260. 260. ce0 4a7 5ec ce0 4a7 5ecdeveloper 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
    261. 261. nickh/ schacon/ jessic e4a e4a project project proje 24f ec5 c12 ce0 4a7 5ec ce0 4a7 5ecdeveloper "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
    262. 262. ce0 ce0 4a7 4a7 5ec 5ec ce0 ce0 4a7 4a7 5ec 5ecdeveloperdeveloper developer developer e4a e4a e4a e4a nick nick jessica jessica 24f 24f ec5 ec5 c12 c12 4ea 4ea df7 df7 2fb 2fb a09 a09 ce0 ce0 4a7 4a7 5ec 5ec ce0 ce0 4a7 4a7 5ec 5ec ce0 ce0 4a7 4a7 5ec 5ec nickh/ nickh/ schacon/ schacon/ jessica/ jessica/ e4a e4a e4a e4a e4a e4a project project project project project project 24f 24f ec5 ec5 c12 c12 4ea 4ea df7 df7 2fb 2fb "nick" "public" "jess" a09 a09 ce0 ce0 4a7 4a7 5ec 5ec master master master my repo my repo e4a e4a public/master public/master public/master 24f 24f ec5 ec5 c12 c12 nick/master nick/master 4ea df7 2fb jess/master a09 git fetchnick jess git remote add jess git://github.com/jessica/project.git git fetch jess

    ×