140. Hash Benefits
Independence
‣ Time & location separation from sequence # of
checkin.
‣ Easy merging of repositories
‣ Easy identification of what needs to be synced
145. Subversion
‣ svn commit
‣ Adds everything modified.
‣ “committed” locally and on the server.
‣ Must list if you want specific files.
‣ What if you check in your password?
150. Git
‣ git add
‣ git commit
‣ git push
‣ Commits only what is added to the index.
‣ Opportunity to change history locally.
‣ Selectively share with other repos.
153. repo
git clone git://somedomain/myproj.git B uild
cd myproj.git
dex
pda te in
git checkout master U
echo ‘//Comments’ >> ClassOne.java or king
echo ‘//Thoughts’ >> ClassTwo.java E dit w
154. repo
git clone git://somedomain/myproj.git B uild
cd myproj.git
dex
pda te in
git checkout master U
echo ‘//Comments’ >> ClassOne.java or king
echo ‘//Thoughts’ >> ClassTwo.java E dit w
to i ndex
git add ClassOne.java Add epo
ave to r
git commit -m’Added comments’ S
155. repo
git clone git://somedomain/myproj.git B uild
cd myproj.git
dex
pda te in
git checkout master U
echo ‘//Comments’ >> ClassOne.java or king
echo ‘//Thoughts’ >> ClassTwo.java E dit w
to i ndex
git add ClassOne.java Add epo
ave to r
git commit -m’Added comments’ S
st ash
git stash Pus h to
156. Remote
is like a special
Stash
Repo
Index
Working
157. Remote
is like a special
Stash
Repo
Index
Working
158. Remote
is like a special
Stash
Repo
git clone
Index
Working
159. Remote
is like a special
Stash
Repo
git clone
git checkout
Index
Working
160. Remote
is like a special
Stash
Repo
git clone
git checkout
edit experiment files
Index
Working
161. Remote
is like a special
Stash
Repo
git clone
git checkout
edit experiment files
git stash
Index
Working
162. Remote
is like a special
Stash
Repo
git clone
git checkout
edit experiment files
git stash
test buggy files
Index
Working
163. Remote
is like a special
Stash
Repo
git clone
git checkout
edit experiment files
git stash
test buggy files
Index git stash apply
Working
164. Remote
is like a special
Stash
Repo
git clone
git checkout
edit experiment files
git stash
test buggy files
Index git stash apply
Working git add
165. Remote
is like a special
Stash
Repo
git clone
git checkout
edit experiment files
git stash
test buggy files
Index git stash apply
Working git add
git commit
166. Remote
is like a special
Stash
Repo
git clone
git checkout
edit experiment files
git stash
test buggy files
Index git stash apply
Working git add
git commit
git push
167. Remote
is like a special
Stash
Repo
git clone
git checkout
edit experiment files
git stash
test buggy files
Index git stash apply
Working git add
git commit
git push
170. $ echo //MYD0GSNAM3 >> mattfile1.txt
$ echo //NewText2 >> mattfile2.txt
$ git status
# On branch master
# Changed but not updated:
# modified: mattfile1.txt
# modified: mattfile2.txt
171. $ echo //MYD0GSNAM3 >> mattfile1.txt
$ echo //NewText2 >> mattfile2.txt
$ git status
# On branch master
# Changed but not updated:
# modified: mattfile1.txt
# modified: mattfile2.txt
o in dex
int
$ git add mattfile1.txt Put
172. $ echo //MYD0GSNAM3 >> mattfile1.txt
$ echo //NewText2 >> mattfile2.txt
$ git status
# On branch master
# Changed but not updated:
# modified: mattfile1.txt
# modified: mattfile2.txt
o in dex
int
$ git add mattfile1.txt Put
to r epo
S ave
$ git commit -m'Matts pw checkin'
[master]: created ddcdf18: quot;Matts pw checkinquot;
1 files changed, 1 insertions(+), 0 deletions(-)
174. Change History
$ git reset --hard HEAD^
HEAD is now at 9de4cd3 First checkin
$ git log
commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993
Author: Matthew McCullough
<matthewm@ambientideas.com>
Date: Wed Mar 4 23:09:17 2009 -0700
First checkin
175. Change History
com mit
the
w a way
$ git reset --hard HEAD^ T hro
HEAD is now at 9de4cd3 First checkin
$ git log
commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993
Author: Matthew McCullough
<matthewm@ambientideas.com>
Date: Wed Mar 4 23:09:17 2009 -0700
First checkin
176. Change History
com mit
the
w a way
$ git reset --hard HEAD^ T hro
HEAD is now at 9de4cd3 First checkin
$ git log
commit 9de4cd3a3f24a3de3e804df84cc3321c7d0c9993
Author: Matthew McCullough
<matthewm@ambientideas.com>
Date: Wed Mar 4 23:09:17 2009 -0700
First checkin
184. aem on
git clone git://somehost.org/myproj.git g it d
git clone mccm06@somehost.org:myproj.git SSH
185. aem on
git clone git://somehost.org/myproj.git g it d
git clone mccm06@somehost.org:myproj.git SSH
git clone http://somehost.org/myproj.git H TTP
186. aem on
git clone git://somehost.org/myproj.git g it d
git clone mccm06@somehost.org:myproj.git SSH
git clone http://somehost.org/myproj.git H TTP
sys tem
git clone ~/work/myproj.git File
187. aem on
git clone git://somehost.org/myproj.git g it d
git clone mccm06@somehost.org:myproj.git SSH
git clone http://somehost.org/myproj.git H TTP
sys tem
git clone ~/work/myproj.git File
rk d rive
Ne two
git clone z:someservermyproj.git
194. Rebase for Clarity
git checkout myfeaturebranch
git rebase master
‣Cleaner history than a merge.
‣Fast forwards original branch.
‣Lets you see “how trunk will act” before you merge.
‣Reposition your feature branch’s start point.
‣Makes for simpler merge graphs.
195. M
da
S er
r
ta g
d
n e
Master/Trunk/MainLatest
196. M
da
S er
r
ta g
d
n e
Master/Trunk/MainLatest
a32
197. ard Bra
d
n e
ta g
a32 n ch
S er
Master/Trunk/MainLatest
M 2e2
198. ard Bra
d
n e
ta g
a32 n ch
S er
Master/Trunk/MainLatest
d19
M 2e2
199. ard Bra
d
n e
ta g
a32 n ch
S er
Master/Trunk/MainLatest
d19
M 2e2
8b3
200. ard Bra
d
n e
ta g
a32 n ch
S er
Master/Trunk/MainLatest
d19
M 2e2
e69
8b3
201. ard Bra
d
n e
ta g
a32 n ch
S er
Master/Trunk/MainLatest
d19
M 2e2
e69
8b3
erge
M
9f1
277. Squash Verbosity
❷
‣git merge --squash mybranch
‣Reduce all your micro-checkins to block commits.
278. Squash Verbosity
❷
‣git merge --squash mybranch
‣Reduce all your micro-checkins to block commits.
‣Make mistakes, revise, checkin without hesitation.
279. Squash Verbosity
❷
‣git merge --squash mybranch
‣Reduce all your micro-checkins to block commits.
‣Make mistakes, revise, checkin without hesitation.
‣Great for SVN compatibility.
288. Twitter
@matthewmccull Matthew
Blog
http://www.ambientideas.com/blog
sidebar has all my social media links
Email
matthewm@ambientideas.com
GitHub
http://github.com/matthewmccullough