38. No Network Needed
Performing a diff
Viewing file history
Committing changes
39. No Network Needed
Performing a diff
Viewing file history
Committing changes
Merging branches
40. No Network Needed
Performing a diff
Viewing file history
Committing changes
Merging branches
Obtaining any other revision of a file
41. No Network Needed
Performing a diff
Viewing file history
Committing changes
Merging branches
Obtaining any other revision of a file
Switching branches
52. $ du -h testrepo/
78M testrepo/
$ cd testrepo/
$ time git checkout -b newbranch
Switched to a new branch "newbranch"
real 0m0.091s
user 0m0.016s
sys 0m0.023s
53. $ du -h testrepo/
78M testrepo/
$ cd testrepo/
$ time git checkout -b newbranch
Switched to a new branch "newbranch"
real 0m0.091s
user 0m0.016s
sys 0m0.023s
54. $ du -h testrepo/
78M testrepo/
$ cd testrepo/
$ time git checkout -b newbranch
Switched to a new branch "newbranch"
real 0m0.091s
user 0m0.016s
sys 0m0.023s
55. $ du -h testrepo/
78M testrepo/
$ cd testrepo/
$ time git checkout -b newbranch
Switched to a new branch "newbranch"
real 0m0.091s
user 0m0.016s
sys 0m0.023s
56. $ du -h testrepo/
78M testrepo/
$ cd testrepo/
$ time git checkout -b newbranch
Switched to a new branch "newbranch"
real 0m0.091s
user 0m0.016s
sys 0m0.023s
57. $ time cp -Rf testrepo r2
real 0m13.684s
user 0m0.085s
sys 0m1.215s
108. $ 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
109. $ 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
110. $ 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
111. $ 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
112. $ 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
113. $ 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
114. $ 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
115. $ 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
116. A Basic Workflow
Edit files
Stage the changes
Review your changes
Commit the changes
120. $ git add main.py
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>.
#
# modified: main.py
#
121. $ git add main.py
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>.
#
# modified: main.py
#
122. $ git add main.py
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>.
#
# modified: main.py
#
123. $ git add main.py
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>.
#
# modified: main.py
#
124. $ git add main.py
$ git status
# On branch master
# Changes to be committed:
THAT ARE STAGED
# (use "git reset HEAD <file>.
#
# modified: main.py
#
130. $ 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
#
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
#
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
#
133. $ 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
134. $ 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
135. $ 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
136. $ 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
137. $ 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
138. $ 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
#
139. $ 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
#
140. $ 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
#
141. $ 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
#
142. $ 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
#
143. $ 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
#
144. 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 = application =
webapp.WSGIApplication([('/' webapp.WSGIApplication([('/'
debug=True) debug=True)
wsgiref.handlers.CGIHandler().run(applicat wsgiref.handlers.CGIHandler().run(applicat
if __name__ == '__main__': if __name__ == '__main__':
main() main()
145. 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 = application =
webapp.WSGIApplication([('/' webapp.WSGIApplication([('/'
debug=True) debug=True)
wsgiref.handlers.CGIHandler().run(applicat wsgiref.handlers.CGIHandler().run(applicat
if __name__ == '__main__': if __name__ == '__main__':
main() main()
156. $ 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
157. $ 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
158. $ 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
159. $ 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
160. $ 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
179. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b
ae668..
commit size
tree c4ec5
parent a149e
author Scott
committer Scott
my commit message goes here
and it is really, really cool
180. 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
181. 77d3001a1de6bf8f5e431972fe4d25b01e595c0b
ae668..
commit size
tree c4ec5
parent a149e
author Scott
committer Scott
my commit message goes here
and it is really, really cool
182. 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
183. 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
184. 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
185. 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
186. 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
187. 48e
32a
ae668..
f46
23f 30e commit size
67e commit size
commit size
tree
tree c4ec5
c4e 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 I'm not sure why
Scott
Scott
this is the commit before that
and I'm 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
243. local repo
public repo public repo
internet
local repo
A B C
244. local repo
public repo public repo
A B C
internet
git push
(ssh)
local repo
A B C
245. local repo
git fetch A B C
(git)
public repo public repo
A B C
internet
git push
(ssh)
local repo
A B C
246. 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
247. 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
248. 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
249. 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
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 &#x2018;git add&#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 &#x2018;git add&#x2019; on files, it caches the snapshot of those versions of the files in the index\n
then when you run &#x2018;git commit&#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 &#x2018;git added&#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