Smacking Git Around Advanced Git Tricks

  • 3,342 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,342
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
216
Comments
0
Likes
23

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Smacking Git Around by Scott Chacon
  • 2. Me
  • 3. Scott Chacon
  • 4. github.com/schacon
  • 5. “Scott Chacon has an understandable but borderline unhealthy obsession with Git” - Ilya Grigorik igvita.com
  • 6. git-scm.com
  • 7. book.git-scm.com
  • 8. schacon@gmail.com
  • 9. </me>
  • 10. previously, on Git...
  • 11. GIT
  • 12. Git
  • 13. image by matthew mccullough
  • 14. Scott Chacon Scott Scott Chacon is a Git v1 v2 v3
  • 15. 98ca9.. 34ac2.. f30ab.. commit commit commit size size size tree tree tree 0de24 184ca 92ec2 author parent parent Scott 98ca9 34ac2 committer author author Scott Scott Scott committer committer initial commit of my project Scott Scott fixed bug #1328 - stack add feature #32 - ability to overflow under certain add new formats to the central snapshot A snapshot B snapshot C
  • 16. 98ca9.. e8455.. commit size blob size 0de24.. 0de24.. tree 0de24 == LICENSE: tree size parent nil (The MIT License) author Scott blob e8455 README Copyright (c) 2007 Tom Preston- committer Scott tree 10af9 lib Permission is hereby granted, f my commit message goes here ree of charge, to any person ob and it is really, really cool bc52a.. 10af9.. blob size tree size require 'grit/index' blob bc52a mylib.rb require 'grit/status' tree b70f8 inc module Grit class << self attr_accessor :debug b70f8.. 0ad1a.. tree size size blob blob 0ad1a tricks.rb require 'grit/git-ruby/reposi require 'grit/git-ruby/file_i module Grit module Tricks
  • 17. 98ca9.. e8455.. commit size blob size 0de24.. 0de24.. tree 0de24 == LICENSE: tree size parent nil (The MIT License) author Scott blob e8455 README Copyright (c) 2007 Tom Preston- committer Scott tree 10af9 lib Permission is hereby granted, f my commit message goes here ree of charge, to any person ob and it is really, really cool bc52a.. 10af9.. blob size tree size require 'grit/index' blob bc52a mylib.rb require 'grit/status' tree b70f8 inc module Grit class << self attr_accessor :debug b70f8.. 0ad1a.. tree size size blob blob 0ad1a tricks.rb require 'grit/git-ruby/reposi require 'grit/git-ruby/file_i module Grit module Tricks
  • 18. 0de24.. 22d8858e8513666bf91b82bd2939ec7b0d1974da
  • 19. stable master 98ca9 34ac2 f30ab a23fe 3acd1 topic
  • 20. stable master 98ca9 34ac2 f30ab a23fe 3acd1 topic
  • 21. stable master 98ca9 34ac2 f30ab a23fe 3acd1 topic
  • 22. stable master 98ca9 34ac2 f30ab a23fe 3acd1 topic
  • 23. $ time git checkout -b newbranch Switched to a new branch quot;newbranchquot; real 0m0.040s user 0m0.003s sys 0m0.008s
  • 24. $ time git checkout -b newbranch Switched to a new branch quot;newbranchquot; real 0m0.040s user 0m0.003s sys 0m0.008s
  • 25. master develop topic
  • 26. distributed development image by matthew mccullough
  • 27. ccf03da00eca1b60a489354c1278c27f1fbc55dc a640106f173c5be59ed5757cf33f568b3e10994f c51a137df64b8ed2f8d84ad62df7b49b1c409906 7e06f7f8d471d5ccbe958fcfaef0fc48ff1a3def dafe95908f7b9cbd2697f04544b68904a6c59aac 2934b685f5dfd2b12c5d7d35d07c6058640f0581 d3b47a90ef9bf2d7bbc5a7cf2b2f27eef4a08f04 dbfeee0f5717d9978788da17cd6853316c92744a 864734938d4044fc5e713e4818f60ecb4f460525 3793a0108438a539f958236dbb9f4ea98b6b70ea 00a60fa1439f082128c1ec03ec3c73acab074d31 6ba82b4879f04de35ffe2ef02d50df0adf184fad 861020b6afeeec245afa2f864c72f5c2588295be 505f3128a573bfe1d23aec2acef83c34c3cbd8be 213e6f8761df038ab0b7c34a9fc4c2c3ce6c8b43 798a8088bcc7cf47fdb33a9d79e398220b660f88
  • 28. C
  • 29. fast
  • 30. efficient
  • 31. 100k repos
  • 32. 80k users
  • 33. </git-recap>
  • 34. Git Tips and Tricks
  • 35. Tips and Tricks Selection and Ranges Data Munging Debugging Customizing
  • 36. Selection and Ranges
  • 37. Revision Selection
  • 38. Revision Selection alternate ways to refer to objects or ranges of objects
  • 39. Revision Selection full sha-1 partial sha-1 branch or tag name caret parent tilde spec blob spec relative specs ranges
  • 40. Full SHA1 6e453f523fa1da50ecb04431101112b3611c6a4d
  • 41. Partial SHA1 6e453f523fa1da50ecb04431101112b3611c6a4d 6e453f523fa1da50 6e453
  • 42. Branch, Remote or Tag Name v1.0 default m/cupcake
  • 43. Caret Parent default^2 2nd parent of ‘default’
  • 44. b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 45. master^ b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 46. master^2 b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 47. Tilde Spec default~2 grandparent of ‘default’ (parent of the parent)
  • 48. master~2 b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 49. master^^^2 master~2^2 b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 50. master^^^2 master~2^2 b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 51. master^^^2 master~2^2 b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 52. Blob Spec default:path/to/file blob of that file in ‘default’ commit
  • 53. Relative Specs master@{yesterday} the commit ‘master’ was at yesterday
  • 54. Relative Specs master@{5} the 5th prior value of ‘master’ (locally)
  • 55. Ranges
  • 56. Ranges ce0e4..e4272 every commit reachable by e4272 that is not reachable by ce034
  • 57. Ranges [old]..[new] every commit reachable by [new] that is not reachable by [old]
  • 58. Ranges ce0e4.. everything since a commit
  • 59. “Reachability”
  • 60. jess/master..master b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 61. jess/master..master b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 62. jess/master..master b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 63. jess/master..master b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 64. jess/master..master b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 65. jess/master..master b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 66. jess/master..master b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 67. jess/master..master b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 68. jess/master..c36ae b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 69. jess/master..c36ae b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 70. jess/master..c36ae b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 71. jess/master..c36ae b3be1 a09c6 df2fa c36ae 5ec47 ce0e4 2f45e 4eadf 2fbb3 18cae jess/master master
  • 72. Advanced Log
  • 73. Log Subsets
  • 74. what am I going to push?
  • 75. git log origin/master..
  • 76. C1 origin/master master HEAD C0
  • 77. C4 master HEAD C3 C2 C1 origin/master C0
  • 78. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git fetch origin C0
  • 79. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git log origin/master.. C0
  • 80. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git log origin/master..HEAD C0
  • 81. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git log origin/master..HEAD C0
  • 82. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git log origin/master..HEAD C0
  • 83. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git log origin/master..HEAD C0
  • 84. commit 72d404debaa804fca82fd9cf710fbde48c7305c6 Author: Shawn O. Pearce <spearce@spearce.org> Date: Sun Oct 12 13:13:59 2008 -0700 test-lib: fix broken printf b8eecafd888d219633f4c29e8b6a90fc21a46dfd introduced usage of printf without a format string. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> commit 969c877506cf8cc760c7b251fef6c5b6850bfc19 Author: Jeff King <peff@peff.net> Date: Sun Oct 12 00:06:11 2008 -0400 git apply --directory broken for new files We carefully verify that the input to git-apply is sane, including cross-checking that the filenames we see in quot;+++quot; headers match what was provided on the command line of quot;diff --gitquot;. When --directory is used, however, we ended up comparing the unadorned name to one with the prepended root, causing us to complain about a mismatch. We simply need to prepend the root directory, if any, when pulling the name out of the git header. commit ff74126c03a8dfd04e7533573a5c420f2a7112ac Author: Johannes Schindelin <Johannes.Schindelin@gmx.de> Date: Fri Oct 10 13:42:12 2008 +0200 rebase -i: do not fail when there is no commit to cherry-pick
  • 85. commit 72d404debaa804fca82fd9cf710fbde48c7305c6 C4 Author: Shawn O. Pearce <spearce@spearce.org> Date: Sun Oct 12 13:13:59 2008 -0700 test-lib: fix broken printf b8eecafd888d219633f4c29e8b6a90fc21a46dfd introduced usage of printf without a format string. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> commit 969c877506cf8cc760c7b251fef6c5b6850bfc19 C3 Author: Jeff King <peff@peff.net> Date: Sun Oct 12 00:06:11 2008 -0400 git apply --directory broken for new files We carefully verify that the input to git-apply is sane, including cross-checking that the filenames we see in quot;+++quot; headers match what was provided on the command line of quot;diff --gitquot;. When --directory is used, however, we ended up comparing the unadorned name to one with the prepended root, causing us to complain about a mismatch. We simply need to prepend the root directory, if any, when pulling the name out of the git header. commit ff74126c03a8dfd04e7533573a5c420f2a7112ac C2 Author: Johannes Schindelin <Johannes.Schindelin@gmx.de> Date: Fri Oct 10 13:42:12 2008 +0200 rebase -i: do not fail when there is no commit to cherry-pick
  • 86. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git log origin/master .. HEAD C0
  • 87. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git log HEAD .. origin/master C0
  • 88. C7 C4 origin/master master HEAD C6 C3 C5 C2 C1 git log HEAD .. origin/master C0 “commits in origin/master not in HEAD”
  • 89. git log origin/master.. git log origin/master..HEAD git log origin/master..master git log master ^origin/master git log master --not origin/master
  • 90. git log HEAD ^origin/master
  • 91. git log HEAD ^origin/master
  • 92. git log master topic1 ^origin/master
  • 93. origin/master C1 C0
  • 94. master C3 origin/master C1 C0
  • 95. experiment C10 C9 C8 master C3 origin/master C1 C0
  • 96. experiment C10 master origin/master C9 C7 C5 C6 C4 C8 C2 C3 C1 C0
  • 97. which changes aren’t in experiment?
  • 98. git log origin/master master ^experiment experiment C10 master origin/master C9 C7 C5 C6 C4 C8 C2 C3 C1 C0
  • 99. git log origin/master master ^experiment experiment C10 master origin/master C9 C7 C5 C6 C4 C8 C2 C3 C1 C0
  • 100. git log origin/master master ^experiment experiment C10 master origin/master C9 C7 C5 C6 C4 C8 C2 C3 C1 C0
  • 101. git log origin/master master ^experiment experiment C10 master origin/master C9 C7 C5 C6 C4 C8 C2 C3 C1 C0
  • 102. git log origin/master master ^experiment experiment C10 master origin/master C9 C7 C5 C6 C4 C8 C2 C3 C1 C0
  • 103. git log origin/master master ^experiment experiment C10 master origin/master C9 C7 C5 C6 C4 C8 C2 C3 C1 C0
  • 104. git log origin/master master ^experiment experiment C10 master origin/master C9 C7 C5 C6 C4 C8 C2 C3 C1 C0
  • 105. git log --graph
  • 106. git log --pretty=oneline --graph
  • 107. gitk
  • 108. gitk 6d13f..41aba
  • 109. Revision Diffs
  • 110. git diff revA revB
  • 111. $ echo ‘version one’ > test $ git add test $ git commit -m ‘C1’ master C1
  • 112. $ git checkout -b topic $ echo ‘version two’ >> test $ git commit -m ‘C2’ topic C2 master C1
  • 113. $ echo ‘version three’ >> test $ git commit -m ‘C3’ topic C3 C2 master C1
  • 114. $ git checkout master $ echo ‘version four’ >> test $ git commit -m ‘C4’ topic C3 master C4 C2 C1
  • 115. $ echo ‘version five’ >> test $ git commit -m ‘C5’ master topic C5 C3 C4 C2 C1
  • 116. master topic $ git diff topic C5 C3 C4 C2 C1
  • 117. master topic what does topic have $ git diff topic C5 C3 that I don’t have? C4 C2 C1
  • 118. master topic what would happen if I $ git diff topic C5 C3 merged in topic? C4 C2 C1
  • 119. master topic how do I make topic $ git diff topic C5 C3 look like HEAD? C4 C2 C1
  • 120. $ git diff topic diff --git a/test b/test master topic index 304313d..bd8c6c9 100644 --- a/test +++ b/test C5 C3 @@ -1,3 +1,3 @@ version one -version two -version three C4 C2 +version four +version five C1
  • 121. $ git diff topic diff --git a/test b/test master topic index 304313d..bd8c6c9 100644 --- a/test +++ b/test C5 C3 @@ -1,3 +1,3 @@ version one -version two -version three C4 C2 +version four +version five C1
  • 122. $ git diff HEAD topic diff --git a/test b/test master topic index bd8c6c9..304313d 100644 --- a/test +++ b/test C5 C3 @@ -1,3 +1,3 @@ version one -version four -version five C4 C2 +version two +version three C1
  • 123. $ git diff HEAD topic diff --git a/test b/test master topic index bd8c6c9..304313d 100644 --- a/test +++ b/test C5 C3 @@ -1,3 +1,3 @@ version one -version four -version five C4 C2 +version two +version three C1
  • 124. git diff HEAD topic
  • 125. git diff HEAD...topic
  • 126. git diff HEAD...topic
  • 127. $ git diff HEAD topic master topic C5 C3 C4 C2 C1
  • 128. $ git diff HEAD topic master topic C5 C3 C4 C2 C1
  • 129. $ git diff HEAD...topic master topic C5 C3 C4 C2 C1
  • 130. $ git diff HEAD...topic diff --git a/test b/test master topic index 9bc69cf..304313d 100644 --- a/test +++ b/test @@ -1 +1,3 @@ C5 C3 version one +version two +version three C4 C2 C1
  • 131. $ git diff HEAD...topic diff --git a/test b/test master topic index 9bc69cf..304313d 100644 --- a/test what would happen if I +++ b/test @@ -1 +1,3 @@ C5 C3 merged in topic? version one +version two +version three C4 C2 C1
  • 132. Data Munging
  • 133. Rewriting History
  • 134. Modifying the last commit
  • 135. git commit --amend
  • 136. Rebasing
  • 137. master topic C5 C3 C4 C2 C1
  • 138. topic C6 master C5 C3 C4 C2 C1 git merge master
  • 139. master topic C5 C3 C4 C2 C1 git rebase master
  • 140. master topic C5 C3 C4 C2 C1 git rebase master
  • 141. master topic C5 C3 C4 C2 C1 git rebase master
  • 142. master topic C5 C3 C4 C2 C1 git rebase master
  • 143. master topic git diff c2 c3 > 2-3.patch C5 C3 C4 C2 C1 git rebase master
  • 144. master topic git diff c2 c3 > 2-3.patch C5 C3 diff --git a/test b/test index 2eadcec..bd8c6c9 100644 --- a/test C4 C2 +++ b/test @@ -1,2 +1,3 @@ version one version four C1 +version five git rebase master
  • 145. master topic C5 C3 C4 C2 C1 2-3.patch
  • 146. master topic C5 C3 C4 C2 git diff c1 c2 > 1-2.patch C1 2-3.patch
  • 147. master topic C5 C3 C4 C2 git diff c1 c2 > 1-2.patch 1-2.patch C1 2-3.patch
  • 148. master topic C5 C3 C4 C2 1-2.patch C1 2-3.patch
  • 149. git rebase master master topic C5 C3 C4 C2 1-2.patch C1 2-3.patch
  • 150. git rebase master 1-2.patch master topic C5 C3 C4 C2 C1 2-3.patch
  • 151. git rebase master topic master C2' C5 C3 C4 C2 C1 2-3.patch
  • 152. git rebase master 2-3.patch topic master C2' C5 C3 C4 C2 C1
  • 153. topic git rebase master C3' master C2' C5 C3 C4 C2 C1
  • 154. topic C3' master C2' git rebase master C5 C3 C4 C2 C1
  • 155. topic C3' master C2' git rebase master C5 C3 C4 C2 C1
  • 156. topic C3' C2' git rebase master C5 master C4 C1
  • 157. Fun with Rebasing
  • 158. rebase --onto
  • 159. Transplanting Topic Branches
  • 160. master C1 C2
  • 161. master C1 C2 C3 server
  • 162. master C1 C2 C3 server C8 C9 client
  • 163. master C1 C2 C3 C4 C10 server C8 C9 client
  • 164. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client
  • 165. move your ‘client’ branch work to your ‘master’ branch
  • 166. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client
  • 167. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client
  • 168. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase master
  • 169. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase master
  • 170. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase master
  • 171. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase master
  • 172. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase server
  • 173. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase server
  • 174. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase server
  • 175. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase server
  • 176. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase --onto master server
  • 177. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase --onto master server
  • 178. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase --onto master server
  • 179. master C1 C2 C5 C6 C3 C4 C10 server C8 C9 client git rebase --onto master server
  • 180. master client master C1 C5 C6 C8' C9' C1 C2 C6 C8 C9 C3 C4 C10 C4 C10 server server C8 C9 C8 C9 client
  • 181. master client C1 C2 C5 C6 C8' C9' C3 C4 C10 server C8 C9
  • 182. master client C1 C2 C5 C6 C8' C9' C3 C4 C10 server C8 C9 git checkout server git rebase master
  • 183. master client C1 C2 C5 C6 C8' C9' C3 C4 C10 server C8 C9 git checkout server git rebase client
  • 184. master client C1 C2 C5 C6 C8' C9' C3 C4 C10 server C8 C9 git checkout server git rebase client
  • 185. master client client C1 C2 C5 C6 C8' C9' C6 C3' C4' C10' C3 C4 C10 server C8 C9 git checkout server git rebase client
  • 186. client client server master C3' C10' C1 C1 C2 C2 C5 C5 C6 C6 C8' C8' C9' C9' C3' C4' git checkout server git rebase client
  • 187. client server master C1 C2 C5 C6 C8' C9' C3' C4' C10' git checkout server git rebase client
  • 188. transplant some of a topic branch
  • 189. master C0 C1 C2 C3 C4 C5 topic
  • 190. master C0 C1 C2 C3 C4 C5 topic
  • 191. master C0 C1 C2 C3 C4 C5 topic git branch newtopic C3
  • 192. master C0 C1 C2 C3 C4 C5 newtopic topic git branch newtopic C3
  • 193. master C0 C1 C2 C3 C4 C5 newtopic topic git branch newtopic C3 git rebase --onto master newtopic
  • 194. master topic C4' C5' C0 C1 C2 C3 C4 C5 newtopic git branch newtopic C3 git rebase --onto master newtopic
  • 195. Fixing a commit several back
  • 196. git rebase -i git rebase --interactive
  • 197. default C4 C3 C2 C1 C0
  • 198. default C4 C3 C2 C1 C0
  • 199. default C4 C3 default~2 C2 C1 C0
  • 200. default C4 C3 default~2 C2 C1 C0
  • 201. git rebase -i default~2^
  • 202. git rebase -i default~2^
  • 203. git rebase -i default~2^
  • 204. pick 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args pick 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 205. C2 pick 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args C3 pick 72d404d test-lib: fix broken printf C4 # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 206. pick 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args pick 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 207. pick 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args pick 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 208. pick 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args pick 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 209. pick 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args pick 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 210. pick 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args pick 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 211. edit 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args pick 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 212. $ git rebase -i default~2^ Stopped at 969c877... git apply --directory broken for new files You can amend the commit now, with git commit --amend Once you are satisfied with your changes, run git rebase --continue $_
  • 213. $ git rebase -i default~2^ Stopped at 969c877... git apply --directory broken for new files You can amend the commit now, with git commit --amend Once you are satisfied with your changes, run git rebase --continue $_ edit files git add git commit --amend git rebase --continue
  • 214. $ git rebase -i default~2^ Stopped at 969c877... git apply --directory broken for new files You can amend the commit now, with git commit --amend Once you are satisfied with your changes, run git rebase --continue $_ edit files git add git commit --amend git rebase --continue
  • 215. $ git rebase -i default~2^ Stopped at 969c877... git apply --directory broken for new files You can amend the commit now, with git commit --amend Once you are satisfied with your changes, run git rebase --continue $_ edit files git add git commit --amend git rebase --continue
  • 216. $ git rebase -i default~2^ Stopped at 969c877... git apply --directory broken for new files You can amend the commit now, with git commit --amend Once you are satisfied with your changes, run git rebase --continue $_ edit files git add git commit --amend git rebase --continue
  • 217. default C4 C4' C3 C3' C2 C2' C1 C0
  • 218. default C4 C4' C3 C3' C2 C2' C1 C0
  • 219. default C4 C4' C3 C3' C2 C2' C1 C0
  • 220. Squashing commits together
  • 221. pick 969c877 git apply --directory broken for new files pick b75271d git diff <tree>{3,}: do not reverse order of args pick 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 222. pick 969c877 git apply --directory broken for new files squash b75271d git diff <tree>{3,}: do not reverse order of args squash 72d404d test-lib: fix broken printf # Rebase f285a2d..5c283eb onto f285a2d # # Commands: # p, pick = use commit # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # # If you remove a line here THAT COMMIT WILL BE LOST. # However, if you remove everything, the rebase will be aborted. # ~ ~ ~ ~ ~ quot;~/projects/git/.git/rebase-merge/git-rebase-todoquot; 14L, 472C
  • 223. # This is a combination of 3 commits. # The first commit's message is: git apply --directory broken for new files # This is the 2nd commit message: git diff <tree>{3,}: do not reverse order of args # This is the 3rd commit message: test-lib: fix broken printf # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Author: Jeff King <peff@peff.net> # # Not currently on any branch. # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: builtin-apply.c # modified: builtin-diff.c # modified: t/t4013-diff-various.sh # new file: t/t4013/diff.diff_master_master^_side # modified: t/t4128-apply-root.sh # modified: t/test-lib.sh # ~ ~ quot;.git/COMMIT_EDITMSGquot; 39L, 1454C
  • 224. # This is a combination of 3 commits. # The first commit's message is: git apply --directory broken for new files # This is the 2nd commit message: git diff <tree>{3,}: do not reverse order of args # This is the 3rd commit message: test-lib: fix broken printf # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Author: Jeff King <peff@peff.net> # # Not currently on any branch. # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: builtin-apply.c # modified: builtin-diff.c # modified: t/t4013-diff-various.sh # new file: t/t4013/diff.diff_master_master^_side # modified: t/t4128-apply-root.sh # modified: t/test-lib.sh # ~ ~ quot;.git/COMMIT_EDITMSGquot; 39L, 1454C
  • 225. # This is a combination of 3 commits. # The first commit's message is: git apply --directory broken for new files # This is the 2nd commit message: git diff <tree>{3,}: do not reverse order of args # This is the 3rd commit message: test-lib: fix broken printf # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Author: Jeff King <peff@peff.net> # # Not currently on any branch. # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: builtin-apply.c # modified: builtin-diff.c # modified: t/t4013-diff-various.sh # new file: t/t4013/diff.diff_master_master^_side # modified: t/t4128-apply-root.sh # modified: t/test-lib.sh # ~ ~ quot;.git/COMMIT_EDITMSGquot; 39L, 1454C
  • 226. # This is a combination of 3 commits. # The first commit's message is: git apply --directory broken for new files # This is the 2nd commit message: git diff <tree>{3,}: do not reverse order of args # This is the 3rd commit message: test-lib: fix broken printf # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Author: Jeff King <peff@peff.net> # # Not currently on any branch. # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: builtin-apply.c # modified: builtin-diff.c # modified: t/t4013-diff-various.sh # new file: t/t4013/diff.diff_master_master^_side # modified: t/t4128-apply-root.sh # modified: t/test-lib.sh # ~ ~ quot;.git/COMMIT_EDITMSGquot; 39L, 1454C
  • 227. C4 C3 default C2 C5 C1 C0
  • 228. The Perils
  • 229. scott jessica default C1 C0
  • 230. scott jessica default C4 C3 C2 default scott/default C1 C1 C0 C0
  • 231. scott jessica default scott/default default C7 C7 C4 C6 C6 C3 C5 C5 C2 C1 C1 C0 C0
  • 232. scott jessica default C8 scott/default default C7 C7 C4 C6 C6 C3 C5 C5 C2 C1 C1 C0 C0
  • 233. scott jessica default C8 scott/default default C7 C7 C7' C4 C6 C6 C6' C3 C5 C5 C5' C2 C1 C1 C0 C0
  • 234. scott jessica default C8 scott/default default C7' C7 C7 C7' C4 C6' C6 C6 C6' C3 C5' C5 C5 C5' C2 C1 C1 C0 C0
  • 235. scott jessica default C9 C8 scott/default default C7' C7 C7 C7' C4 C6' C6 C6 C6' C3 C5' C5 C5 C5' C2 C1 C1 C0 C0
  • 236. Filter Branch History Revision on Steroids
  • 237. remove all instances of a file from every commit
  • 238. git filter-branch --tree-filter 'rm -f filename' HEAD
  • 239. change your email in all commits
  • 240. git filter-branch --env-filter quot;export GIT_AUTHOR_EMAIL=you@email.comquot; HEAD
  • 241. git filter-branch --env-filter quot;export GIT_AUTHOR_EMAIL=you@email.comquot; origin/master..HEAD
  • 242. Subtree Merging
  • 243. Alternative to Submodules
  • 244. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 245. master C3 C2 C1 C0
  • 246. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 247. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 248. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 249. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 250. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 251. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 252. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 253. $ ls README rack_app.rb $ git remote add rack_remote git@github.com:schacon/rack.git $ git fetch rack_remote warning: no common commits remote: Counting objects: 3184, done. remote: Compressing objects: 100% (1465/1465), done. remote: Total 3184 (delta 1952), reused 2770 (delta 1675) Receiving objects: 100% (3184/3184), 677.42 KiB | 4 KiB/s, do Resolving deltas: 100% (1952/1952), done. From git@github.com:schacon/rack * [new branch] master -> rack_remote/master $ git checkout -b rack_branch rack_remote/master Branch rack_branch set up to track remote branch refs/remotes Switched to a new branch quot;rack_branchquot; $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 254. master C3 rack_branch C6 rack_remote/master C2 C5 C1 C0 C4
  • 255. $ git checkout master $ ls README rack_app.rb $ git checkout rack_branch $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 256. $ git checkout master $ ls README rack_app.rb $ git checkout rack_branch $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 257. $ git checkout master $ ls README rack_app.rb $ git checkout rack_branch $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 258. $ git checkout master $ ls README rack_app.rb $ git checkout rack_branch $ ls AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test
  • 259. checkout ‘rack’ into my project
  • 260. $ git read-tree --prefix=rack/ -u rack_branch $ ls README rack rack_app.rb $ ls rack AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test $ git add rack $ git commit -m 'added rack code' [master 0839fd8] added rack code 108 files changed, 10334 insertions(+), 0 dele create mode 100644 rack/AUTHORS create mode 100644 rack/COPYING ... create mode 100644 rack/test/testrequest.rb
  • 261. $ git read-tree --prefix=rack/ -u rack_branch $ ls README rack rack_app.rb $ ls rack AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test $ git add rack $ git commit -m 'added rack code' [master 0839fd8] added rack code 108 files changed, 10334 insertions(+), 0 dele create mode 100644 rack/AUTHORS create mode 100644 rack/COPYING ... create mode 100644 rack/test/testrequest.rb
  • 262. $ git read-tree --prefix=rack/ -u rack_branch $ ls README rack rack_app.rb $ ls rack AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test $ git add rack $ git commit -m 'added rack code' [master 0839fd8] added rack code 108 files changed, 10334 insertions(+), 0 dele create mode 100644 rack/AUTHORS create mode 100644 rack/COPYING ... create mode 100644 rack/test/testrequest.rb
  • 263. $ git read-tree --prefix=rack/ -u rack_branch $ ls README rack rack_app.rb $ ls rack AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test $ git add rack $ git commit -m 'added rack code' [master 0839fd8] added rack code 108 files changed, 10334 insertions(+), 0 dele create mode 100644 rack/AUTHORS create mode 100644 rack/COPYING ... create mode 100644 rack/test/testrequest.rb
  • 264. $ git read-tree --prefix=rack/ -u rack_branch $ ls README rack rack_app.rb $ ls rack AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test $ git add rack $ git commit -m 'added rack code' [master 0839fd8] added rack code 108 files changed, 10334 insertions(+), 0 dele create mode 100644 rack/AUTHORS create mode 100644 rack/COPYING ... create mode 100644 rack/test/testrequest.rb
  • 265. $ git read-tree --prefix=rack/ -u rack_branch $ ls README rack rack_app.rb $ ls rack AUTHORS KNOWN-ISSUES Rakefile contrib lib COPYING README bin example test $ git add rack $ git commit -m 'added rack code' [master 0839fd8] added rack code 108 files changed, 10334 insertions(+), 0 dele create mode 100644 rack/AUTHORS create mode 100644 rack/COPYING ... create mode 100644 rack/test/testrequest.rb
  • 266. edit a file in rack
  • 267. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge --squash -s subtree --no-commit master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 268. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge --squash -s subtree --no-commit master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 269. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge --squash -s subtree --no-commit master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 270. submit the change back to rack
  • 271. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge --squash -s subtree --no-commit master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 272. git merge -s subtree
  • 273. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 274. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 275. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 276. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 277. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 278. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 279. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 280. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 281. $ vim rack/lib/rack.rb $ git commit -am 'added awesome to rack' [master b1b77ee] added awesome to rack 1 files changed, 1 insertions(+), 0 deletions(-) $ git checkout rack_branch $ git merge -s subtree --no-commit --squash master Squash commit -- not updating HEAD Automatic merge went well; stopped before committin $ git status # On branch rack_branch # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: lib/rack.rb #
  • 282. git merge -s subtree --no-commit --squash master
  • 283. git merge -s subtree --no-commit --squash master really?
  • 284. Tim Dysinger http://dysinger.net/2008/04/29/ replacing-braid-or-piston-for-git-with-40-lines-of-rake/
  • 285. Tim Dysinger http://dysinger.net/2008/04/29/ replacing-braid-or-piston-for-git-with-40-lines-of-rake/ http://tinyurl.com/braidgit
  • 286. Patch Staging
  • 287. git add -p
  • 288. $ git status # On branch master # Changed but not updated: # (use quot;git add <file>...quot; to update what wi # (use quot;git checkout -- <file>...quot; to discar # # modified: ticgit.gemspec # no changes added to commit (use quot;git addquot; and/
  • 289. $ git status # On branch master # Changed but not updated: # (use quot;git add <file>...quot; to update what wi # (use quot;git checkout -- <file>...quot; to discar # # modified: ticgit.gemspec # no changes added to commit (use quot;git addquot; and/
  • 290. $ git add -p diff --git a/ticgit.gemspec b/ticgit.gemspec index 9c32bd4..a44667b 100644 --- a/ticgit.gemspec +++ b/ticgit.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = quot;ticgitquot; - s.version = quot;0.3.5quot; + s.version = quot;0.3.6quot; s.date = quot;2008-05-10quot; s.author = quot;Scott Chaconquot; s.email = quot;schacon@gmail.comquot; Stage this hunk [y,n,a,d,/,j,J,g,e,?]? y
  • 291. $ git add -p diff --git a/ticgit.gemspec b/ticgit.gemspec index 9c32bd4..a44667b 100644 --- a/ticgit.gemspec +++ b/ticgit.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = quot;ticgitquot; - s.version = quot;0.3.5quot; + s.version = quot;0.3.6quot; s.date = quot;2008-05-10quot; s.author = quot;Scott Chaconquot; s.email = quot;schacon@gmail.comquot; Stage this hunk [y,n,a,d,/,j,J,g,e,?]? y
  • 292. $ git add -p diff --git a/ticgit.gemspec b/ticgit.gemspec index 9c32bd4..a44667b 100644 --- a/ticgit.gemspec +++ b/ticgit.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = quot;ticgitquot; - s.version = quot;0.3.5quot; + s.version = quot;0.3.6quot; s.date = quot;2008-05-10quot; s.author = quot;Scott Chaconquot; s.email = quot;schacon@gmail.comquot; Stage this hunk [y,n,a,d,/,j,J,g,e,?]?
  • 293. $ git add -p diff --git a/ticgit.gemspec b/ticgit.gemspec index 9c32bd4..a44667b 100644 --- a/ticgit.gemspec +++ b/ticgit.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.name = quot;ticgitquot; - s.version = quot;0.3.5quot; + s.version = quot;0.3.6quot; s.date = quot;2008-05-10quot; s.author = quot;Scott Chaconquot; s.email = quot;schacon@gmail.comquot; Stage this hunk [y,n,a,d,/,j,J,g,e,?]? y
  • 294. @@ -9,9 +9,10 @@ Gem::Specification.new do |s| s.files = [quot;lib/ticgit/base.rbquot;, quot;lib/ticgit/ quot;lib/ticgit/comment.rbquot;, quot;lib/ticgit/ticket.rbquot;, quot;lib/ ticgit.rbquot;, quot;bin/tiquot;, quot;bin/ticgitwebquot;] s.bindir = 'bin' - s.executables << quot;tiquot; - s.executables << quot;ticgitwebquot; + s.executables = [quot;tiquot;, quot;ticgitwebquot;] + s.default_executable = %q{ti} s.homepage = quot;http://github/schacon/ticgitquot; s.require_paths = [quot;libquot;, quot;binquot;] + s.specification_version = 2 if s.respond_to? :specification_version= end Stage this hunk [y,n,a,d,/,K,g,s,e,?]?
  • 295. @@ -9,9 +9,10 @@ Gem::Specification.new do |s| s.files = [quot;lib/ticgit/base.rbquot;, quot;lib/ticgit/ quot;lib/ticgit/comment.rbquot;, quot;lib/ticgit/ticket.rbquot;, quot;lib/ ticgit.rbquot;, quot;bin/tiquot;, quot;bin/ticgitwebquot;] s.bindir = 'bin' - s.executables << quot;tiquot; - s.executables << quot;ticgitwebquot; + s.executables = [quot;tiquot;, quot;ticgitwebquot;] + s.default_executable = %q{ti} s.homepage = quot;http://github/schacon/ticgitquot; s.require_paths = [quot;libquot;, quot;binquot;] + s.specification_version = 2 if s.respond_to? :specification_version= end Stage this hunk [y,n,a,d,/,K,g,s,e,?]?
  • 296. @@ -9,9 +9,10 @@ Gem::Specification.new do |s| s.files = [quot;lib/ticgit/base.rbquot;, quot;lib/ticgit/ quot;lib/ticgit/comment.rbquot;, quot;lib/ticgit/ticket.rbquot;, quot;lib/ ticgit.rbquot;, quot;bin/tiquot;, quot;bin/ticgitwebquot;] s.bindir = 'bin' - s.executables << quot;tiquot; - s.executables << quot;ticgitwebquot; + s.executables = [quot;tiquot;, quot;ticgitwebquot;] + s.default_executable = %q{ti} s.homepage = quot;http://github/schacon/ticgitquot; s.require_paths = [quot;libquot;, quot;binquot;] + s.specification_version = 2 if s.respond_to? :specification_version= end Stage this hunk [y,n,a,d,/,K,g,s,e,?]? n
  • 297. $ git status # On branch master # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: ticgit.gemspec # # Changed but not updated: # (use quot;git add <file>...quot; to update what will be com # (use quot;git checkout -- <file>...quot; to discard changes # # modified: ticgit.gemspec #
  • 298. $ git status # On branch master # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: ticgit.gemspec # # Changed but not updated: # (use quot;git add <file>...quot; to update what will be com # (use quot;git checkout -- <file>...quot; to discard changes # # modified: ticgit.gemspec #
  • 299. $ git status # On branch master # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: ticgit.gemspec # # Changed but not updated: # (use quot;git add <file>...quot; to update what will be com # (use quot;git checkout -- <file>...quot; to discard changes # # modified: ticgit.gemspec #
  • 300. $ git status # On branch master # Changes to be committed: # (use quot;git reset HEAD <file>...quot; to unstage) # # modified: ticgit.gemspec # # Changed but not updated: # (use quot;git add <file>...quot; to update what will be com # (use quot;git checkout -- <file>...quot; to discard changes # # modified: ticgit.gemspec #
  • 301. partially stage files
  • 302. git add -p
  • 303. Debugging
  • 304. Annotation
  • 305. git blame
  • 306. git blame ie: “what dumbass did this? oh, it was me...”
  • 307. git blame daemon.c 979e32fa (Randal L. Schwartz 2005-10-25 16:29:09 -0700 1) #include quot;cache.hquot; 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 2) #include quot;pkt-line.hquot; 77cb17e9 (Michal Ostrowski 2006-01-10 21:12:17 -0500 3) #include quot;exec_cmd.hquot; 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 4) #include quot;interpolate.hquot; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 5) 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 6) #include <syslog.h> 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 7) 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 8) #ifndef HOST_NAME_MAX 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 9) #define HOST_NAME_MAX 256 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 10) #endif 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 11) 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 12) #ifndef NI_MAXSERV 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 13) #define NI_MAXSERV 32 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 14) #endif 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 15) 9048fe1c (Petr Baudis 2005-09-24 16:13:01 +0200 16) static int log_syslog; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 17) static int verbose; 1955fabf (Mark Wooding 2006-02-03 20:27:04 +0000 18) static int reuseaddr; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 19) 960deccb (H. Peter Anvin 2005-10-19 14:27:01 -0700 20) static const char daemon_usage[] = 1b1dd23f (Stephan Beyer 2008-07-13 15:36:15 +0200 21) quot;git daemon [--verbose] [--syslog] [ 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 22) quot; [--timeout=n] [--init-ti 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 23) quot; [--strict-paths] [--base 73a7a656 (Jens Axboe 2007-07-27 14:00:29 -0700 24) quot; [--user-path | --user-pa 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 25) quot; [--interpolated-path=pat 678dac6b (Tilman Sauerbeck 2006-08-22 19:37:41 +0200 26) quot; [--reuseaddr] [--detach] d9edcbd6 (Junio C Hamano 2006-09-07 01:40:04 -0700 27) quot; [--[enable|disable|allow dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 28) quot; [--inetd | [--listen=hos dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 29) quot; [--user=user dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 30) quot; [directory...]quot;; 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 31) 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 32) /* List of acceptable pathname prefi 96f1e58f (David Rientjes 2006-08-15 10:23:48 -0700 33) static char **ok_paths;
  • 308. git blame daemon.c 979e32fa (Randal L. Schwartz 2005-10-25 16:29:09 -0700 1) #include quot;cache.hquot; 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 2) #include quot;pkt-line.hquot; 77cb17e9 (Michal Ostrowski 2006-01-10 21:12:17 -0500 3) #include quot;exec_cmd.hquot; 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 4) #include quot;interpolate.hquot; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 5) 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 6) #include <syslog.h> 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 7) 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 8) #ifndef HOST_NAME_MAX 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 9) #define HOST_NAME_MAX 256 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 10) #endif 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 11) 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 12) #ifndef NI_MAXSERV 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 13) #define NI_MAXSERV 32 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 14) #endif 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 15) 9048fe1c (Petr Baudis 2005-09-24 16:13:01 +0200 16) static int log_syslog; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 17) static int verbose; 1955fabf (Mark Wooding 2006-02-03 20:27:04 +0000 18) static int reuseaddr; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 19) 960deccb (H. Peter Anvin 2005-10-19 14:27:01 -0700 20) static const char daemon_usage[] = 1b1dd23f (Stephan Beyer 2008-07-13 15:36:15 +0200 21) quot;git daemon [--verbose] [--syslog] [ 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 22) quot; [--timeout=n] [--init-ti 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 23) quot; [--strict-paths] [--base 73a7a656 (Jens Axboe 2007-07-27 14:00:29 -0700 24) quot; [--user-path | --user-pa 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 25) quot; [--interpolated-path=pat 678dac6b (Tilman Sauerbeck 2006-08-22 19:37:41 +0200 26) quot; [--reuseaddr] [--detach] d9edcbd6 (Junio C Hamano 2006-09-07 01:40:04 -0700 27) quot; [--[enable|disable|allow dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 28) quot; [--inetd | [--listen=hos dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 29) quot; [--user=user dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 30) quot; [directory...]quot;; 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 31) 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 32) /* List of acceptable pathname prefi 96f1e58f (David Rientjes 2006-08-15 10:23:48 -0700 33) static char **ok_paths;
  • 309. git blame daemon.c 979e32fa (Randal L. Schwartz 2005-10-25 16:29:09 -0700 1) #include quot;cache.hquot; 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 2) #include quot;pkt-line.hquot; 77cb17e9 (Michal Ostrowski 2006-01-10 21:12:17 -0500 3) #include quot;exec_cmd.hquot; 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 4) #include quot;interpolate.hquot; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 5) 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 6) #include <syslog.h> 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 7) 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 8) #ifndef HOST_NAME_MAX 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 9) #define HOST_NAME_MAX 256 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 10) #endif 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 11) 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 12) #ifndef NI_MAXSERV 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 13) #define NI_MAXSERV 32 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 14) #endif 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 15) 9048fe1c (Petr Baudis 2005-09-24 16:13:01 +0200 16) static int log_syslog; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 17) static int verbose; 1955fabf (Mark Wooding 2006-02-03 20:27:04 +0000 18) static int reuseaddr; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 19) 960deccb (H. Peter Anvin 2005-10-19 14:27:01 -0700 20) static const char daemon_usage[] = 1b1dd23f (Stephan Beyer 2008-07-13 15:36:15 +0200 21) quot;git daemon [--verbose] [--syslog] [ 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 22) quot; [--timeout=n] [--init-ti 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 23) quot; [--strict-paths] [--base 73a7a656 (Jens Axboe 2007-07-27 14:00:29 -0700 24) quot; [--user-path | --user-pa 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 25) quot; [--interpolated-path=pat 678dac6b (Tilman Sauerbeck 2006-08-22 19:37:41 +0200 26) quot; [--reuseaddr] [--detach] d9edcbd6 (Junio C Hamano 2006-09-07 01:40:04 -0700 27) quot; [--[enable|disable|allow dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 28) quot; [--inetd | [--listen=hos dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 29) quot; [--user=user dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 30) quot; [directory...]quot;; 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 31) 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 32) /* List of acceptable pathname prefi 96f1e58f (David Rientjes 2006-08-15 10:23:48 -0700 33) static char **ok_paths;
  • 310. git blame daemon.c 979e32fa (Randal L. Schwartz 2005-10-25 16:29:09 -0700 1) #include quot;cache.hquot; 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 2) #include quot;pkt-line.hquot; 77cb17e9 (Michal Ostrowski 2006-01-10 21:12:17 -0500 3) #include quot;exec_cmd.hquot; 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 4) #include quot;interpolate.hquot; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 5) 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 6) #include <syslog.h> 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 7) 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 8) #ifndef HOST_NAME_MAX 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 9) #define HOST_NAME_MAX 256 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 10) #endif 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 11) 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 12) #ifndef NI_MAXSERV 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 13) #define NI_MAXSERV 32 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 14) #endif 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 15) 9048fe1c (Petr Baudis 2005-09-24 16:13:01 +0200 16) static int log_syslog; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 17) static int verbose; 1955fabf (Mark Wooding 2006-02-03 20:27:04 +0000 18) static int reuseaddr; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 19) 960deccb (H. Peter Anvin 2005-10-19 14:27:01 -0700 20) static const char daemon_usage[] = 1b1dd23f (Stephan Beyer 2008-07-13 15:36:15 +0200 21) quot;git daemon [--verbose] [--syslog] [ 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 22) quot; [--timeout=n] [--init-ti 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 23) quot; [--strict-paths] [--base 73a7a656 (Jens Axboe 2007-07-27 14:00:29 -0700 24) quot; [--user-path | --user-pa 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 25) quot; [--interpolated-path=pat 678dac6b (Tilman Sauerbeck 2006-08-22 19:37:41 +0200 26) quot; [--reuseaddr] [--detach] d9edcbd6 (Junio C Hamano 2006-09-07 01:40:04 -0700 27) quot; [--[enable|disable|allow dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 28) quot; [--inetd | [--listen=hos dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 29) quot; [--user=user dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 30) quot; [directory...]quot;; 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 31) 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 32) /* List of acceptable pathname prefi 96f1e58f (David Rientjes 2006-08-15 10:23:48 -0700 33) static char **ok_paths;
  • 311. git blame daemon.c 979e32fa (Randal L. Schwartz 2005-10-25 16:29:09 -0700 1) #include quot;cache.hquot; 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 2) #include quot;pkt-line.hquot; 77cb17e9 (Michal Ostrowski 2006-01-10 21:12:17 -0500 3) #include quot;exec_cmd.hquot; 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 4) #include quot;interpolate.hquot; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 5) 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 6) #include <syslog.h> 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 7) 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 8) #ifndef HOST_NAME_MAX 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 9) #define HOST_NAME_MAX 256 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 10) #endif 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 11) 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 12) #ifndef NI_MAXSERV 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 13) #define NI_MAXSERV 32 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 14) #endif 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 15) 9048fe1c (Petr Baudis 2005-09-24 16:13:01 +0200 16) static int log_syslog; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 17) static int verbose; 1955fabf (Mark Wooding 2006-02-03 20:27:04 +0000 18) static int reuseaddr; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 19) 960deccb (H. Peter Anvin 2005-10-19 14:27:01 -0700 20) static const char daemon_usage[] = 1b1dd23f (Stephan Beyer 2008-07-13 15:36:15 +0200 21) quot;git daemon [--verbose] [--syslog] [ 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 22) quot; [--timeout=n] [--init-ti 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 23) quot; [--strict-paths] [--base 73a7a656 (Jens Axboe 2007-07-27 14:00:29 -0700 24) quot; [--user-path | --user-pa 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 25) quot; [--interpolated-path=pat 678dac6b (Tilman Sauerbeck 2006-08-22 19:37:41 +0200 26) quot; [--reuseaddr] [--detach] d9edcbd6 (Junio C Hamano 2006-09-07 01:40:04 -0700 27) quot; [--[enable|disable|allow dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 28) quot; [--inetd | [--listen=hos dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 29) quot; [--user=user dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 30) quot; [directory...]quot;; 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 31) 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 32) /* List of acceptable pathname prefi 96f1e58f (David Rientjes 2006-08-15 10:23:48 -0700 33) static char **ok_paths;
  • 312. git blame daemon.c 979e32fa (Randal L. Schwartz 2005-10-25 16:29:09 -0700 1) #include quot;cache.hquot; 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 2) #include quot;pkt-line.hquot; 77cb17e9 (Michal Ostrowski 2006-01-10 21:12:17 -0500 3) #include quot;exec_cmd.hquot; 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 4) #include quot;interpolate.hquot; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 5) 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 6) #include <syslog.h> 85023577 (Junio C Hamano 2006-12-19 14:34:12 -0800 7) 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 8) #ifndef HOST_NAME_MAX 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 9) #define HOST_NAME_MAX 256 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 10) #endif 695dffe2 (Johannes Schindelin 2006-09-28 12:00:35 +0200 11) 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 12) #ifndef NI_MAXSERV 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 13) #define NI_MAXSERV 32 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 14) #endif 415e7b87 (Patrick Welche 2007-10-18 18:17:39 +0100 15) 9048fe1c (Petr Baudis 2005-09-24 16:13:01 +0200 16) static int log_syslog; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 17) static int verbose; 1955fabf (Mark Wooding 2006-02-03 20:27:04 +0000 18) static int reuseaddr; f8ff0c06 (Petr Baudis 2005-09-22 11:25:28 +0200 19) 960deccb (H. Peter Anvin 2005-10-19 14:27:01 -0700 20) static const char daemon_usage[] = 1b1dd23f (Stephan Beyer 2008-07-13 15:36:15 +0200 21) quot;git daemon [--verbose] [--syslog] [ 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 22) quot; [--timeout=n] [--init-ti 3bd62c21 (Stephen R. van den Berg 2008-08-14 20:02:20 +0200 23) quot; [--strict-paths] [--base 73a7a656 (Jens Axboe 2007-07-27 14:00:29 -0700 24) quot; [--user-path | --user-pa 49ba83fb (Jon Loeliger 2006-09-19 20:31:51 -0500 25) quot; [--interpolated-path=pat 678dac6b (Tilman Sauerbeck 2006-08-22 19:37:41 +0200 26) quot; [--reuseaddr] [--detach] d9edcbd6 (Junio C Hamano 2006-09-07 01:40:04 -0700 27) quot; [--[enable|disable|allow dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 28) quot; [--inetd | [--listen=hos dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 29) quot; [--user=user dd467629 (Jon Loeliger 2006-09-26 09:47:43 -0500 30) quot; [directory...]quot;; 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 31) 4ae95682 (H. Peter Anvin 2005-09-26 19:10:55 -0700 32) /* List of acceptable pathname prefi 96f1e58f (David Rientjes 2006-08-15 10:23:48 -0700 33) static char **ok_paths;
  • 313. git blame -C GITPackUpload.m
  • 314. git blame -C GITPackUpload.m f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 12) f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 13) #define PACK_SIGN f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 14) #define PACK_VERS f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 15) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 16) @implementation G ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 17) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 18) @synthesize gitRe ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 19) @synthesize needR ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 20) @synthesize gitSo ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 21) @synthesize refDi ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 22) a2cbabf5 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-25 22:29:39 +0100 23) - (id) initWithGi ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 24) { a2cbabf5 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-25 22:29:39 +0100 25) gitRepo = ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 26) needRefs = ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 27) gitSocket ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 28) return sel ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 29) } ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 30) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 31) - (bool) uploadPa f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 32) { f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 33) NSLog(@quot;up f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 34) NSString * f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 35) NSArray *t f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 36) 56ef2caf Source/Network/GITServerHandler.m (Scott Chacon 2009-01-05 21:44:26 -0800 37) refDict = f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 38)
  • 315. git blame -C GITPackUpload.m f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 12) f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 13) #define PACK_SIGN f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 14) #define PACK_VERS f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 15) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 16) @implementation G ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 17) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 18) @synthesize gitRe ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 19) @synthesize needR ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 20) @synthesize gitSo ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 21) @synthesize refDi ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 22) a2cbabf5 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-25 22:29:39 +0100 23) - (id) initWithGi ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 24) { a2cbabf5 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-25 22:29:39 +0100 25) gitRepo = ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 26) needRefs = ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 27) gitSocket ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 28) return sel ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 29) } ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 30) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 31) - (bool) uploadPa f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 32) { f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 33) NSLog(@quot;up f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 34) NSString * f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 35) NSArray *t f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 36) 56ef2caf Source/Network/GITServerHandler.m (Scott Chacon 2009-01-05 21:44:26 -0800 37) refDict = f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 38)
  • 316. git blame -C GITPackUpload.m f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 12) f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 13) #define PACK_SIGN f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 14) #define PACK_VERS f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 15) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 16) @implementation G ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 17) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 18) @synthesize gitRe ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 19) @synthesize needR ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 20) @synthesize gitSo ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 21) @synthesize refDi ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 22) a2cbabf5 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-25 22:29:39 +0100 23) - (id) initWithGi ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 24) { a2cbabf5 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-25 22:29:39 +0100 25) gitRepo = ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 26) needRefs = ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 27) gitSocket ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 28) return sel ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 29) } ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 30) ad11ac80 Source/Network/GITPackUpload.m (Scott Chacon 2009-03-24 18:32:50 +0100 31) - (bool) uploadPa f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 32) { f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 33) NSLog(@quot;up f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 34) NSString * f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 35) NSArray *t f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 36) 56ef2caf Source/Network/GITServerHandler.m (Scott Chacon 2009-01-05 21:44:26 -0800 37) refDict = f344f58d Source/Network/GITServerHandler.m (Scott Chacon 2009-01-04 18:59:04 -0800 38)
  • 317. Bisecting
  • 318. binary search for where a bug was introduced
  • 319. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table and $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 320. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table and $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 321. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table and $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 322. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table and $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 323. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table and $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 324. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table and $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 325. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table and $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 326. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 327. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 328. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 329. $ git bisect start $ git bisect bad $ git bisect good 3acb4c2c6666ed6cb91cb0b983efe9d50cf8cfbe Bisecting: 6 revisions left to test after this [ecb6e1bc347ccecc5f9350d878ce677feb13d3b2] error handling on repo $ git bisect good Bisecting: 3 revisions left to test after this [b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing $ git bisect bad Bisecting: 1 revisions left to test after this [f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table $ git bisect good b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04 Author: PJ Hyett <pjhyett@gmail.com> Date: Tue Jan 27 14:48:32 2009 -0800 secure this thing :040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730 f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config
  • 330. $ git bisect reset
  • 331. Customizing
  • 332. Autocorrect
  • 333. $ git com git: 'com' is not a git-command. See 'git --help'. Did you mean this? commit
  • 334. $ git com git: 'com' is not a git-command. See 'git --help'. Did you mean this? commit
  • 335. help.autocorrect
  • 336. $ git config --global help.autocorrect 1
  • 337. $ git com WARNING: You called a Git program named 'com', which does not exist. Continuing under the assumption that you meant 'commit'
  • 338. Colors
  • 339. $ git config --global color.ui true
  • 340. Custom Merge Tool
  • 341. perforce visual merge tool
  • 342. http://www.perforce.com/perforce/products/merge.html
  • 343. $ cat /usr/local/bin/extMerge #!/bin/sh /Applications/p4merge.app/Contents/MacOS/p4merge $*
  • 344. $ git config --global merge.tool extMerge $ git config --global mergetool.extMerge.cmd 'extMerge quot;$BASEquot; quot;$LOCALquot; quot;$REMOTEquot; quot;$MERGEDquot;' $ git config --global mergetool.trustExitCode = false
  • 345. ~/.gitconfig [merge] tool = extMerge [mergetool quot;extMergequot;] cmd = extMerge quot;$BASEquot; quot;$LOCALquot; quot;$REMOTEquot; quot;$MERGEDquot; trustExitCode = false
  • 346. git mergetool
  • 347. Git Attributes
  • 348. .gitattributes
  • 349. Diff Binary Files
  • 350. Images
  • 351. diff --git a/image.png b/image.png index 88839c4..4afcb7c 100644 Binary files a/image.png and b/image.png differ
  • 352. tell Git how to diff a binary file
  • 353. exiftool
  • 354. $ echo '*.png diff=exif' >> .gitattributes $ git config diff.exif.textconv exiftool
  • 355. $ echo '*.png diff=exif' >> .gitattributes $ git config diff.exif.textconv exiftool every file that ends in .png
  • 356. $ echo '*.png diff=exif' >> .gitattributes $ git config diff.exif.textconv exiftool pre-process them with a strategy called ‘exif’
  • 357. $ echo '*.png diff=exif' >> .gitattributes $ git config diff.exif.textconv exiftool
  • 358. $ echo '*.png diff=exif' >> .gitattributes $ git config diff.exif.textconv exiftool the ‘exif’ strategy is to run ‘exiftool’ on it
  • 359. $ exiftool image.png ExifTool Version Number : 7.74 File Name : image.png Directory : . File Size : 94 kB File Modification Date/Time : 2009:04:21 07:02:43-07:00 File Type : PNG MIME Type : image/png Image Width : 1056 Image Height : 827 Bit Depth : 8 Color Type : RGB with Alpha Compression : Deflate/Inflate Filter : Adaptive Interlace : Noninterlaced Profile CMM Type : appl Profile Version : 2.0.0 Profile Class : Display Device Profile Color Space Data : RGB Profile Connection Space : XYZ Profile Date Time : 2009:04:05 12:26:58 Profile File Signature : acsp Primary Platform : Apple Computer Inc. CMM Flags : Not Embedded, Independent Device Manufacturer : Device Model : Device Attributes : Reflective, Glossy, Positive, Color Rendering Intent : Perceptual Connection Space Illuminant : 0.9642 1 0.82491 Profile Creator : appl Profile ID : 0 Red Matrix Column : 0.39493 0.22505 0.02957 Green Matrix Column : 0.42793 0.69208 0.14424 Blue Matrix Column : 0.14134 0.08327 0.65096 Media White Point : 0.95047 1 1.0891 Chromatic Adaptation : 1.04788 0.02292 -0.0502 0.02957 0.99049 -0.01706 -0.00923 0.01508 0.75165 Red Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract) Green Tone Reproduction Curve : (Binary data 14 bytes, use -b option to extract)
  • 360. $ echo '*.png diff=exif' >> .gitattributes $ git config diff.exif.textconv exiftool
  • 361. diff --git a/image.png b/image.png index 88839c4..4afcb7c 100644 --- a/image.png +++ b/image.png @@ -1,12 +1,12 @@ ExifTool Version Number : 7.74 -File Size : 70 kB -File Modification Date/Time : 2009:04:21 07:02:45-07:00 +File Size : 94 kB +File Modification Date/Time : 2009:04:21 07:02:43-07:00 File Type : PNG MIME Type : image/png -Image Width : 1058 -Image Height : 889 +Image Width : 1056 +Image Height : 827 Bit Depth : 8 Color Type : RGB with Alpha
  • 362. Documents
  • 363. $ echo '*.doc diff=doc' >> .gitattributes $ git config diff.doc.textconv strings
  • 364. $ git diff diff --git a/chapter1.doc b/chapter1.doc index c1c8a0a..b93c9e4 100644 --- a/chapter1.doc +++ b/chapter1.doc @@ -8,7 +8,8 @@ re going to cover Version Control System re going to cover how to get it and set it up for the f t already have it on your system. In Chapter Two we will go over basic Git usage - how to -s going on, modify stuff and contribute changes. If the +s going on, modify stuff and contribute changes. If the +Let's see if this works. Chapter Three is about the branching model in Git, ofte
  • 365. $ git diff diff --git a/chapter1.doc b/chapter1.doc index c1c8a0a..b93c9e4 100644 --- a/chapter1.doc +++ b/chapter1.doc @@ -8,7 +8,8 @@ re going to cover Version Control System re going to cover how to get it and set it up for the f t already have it on your system. In Chapter Two we will go over basic Git usage - how to -s going on, modify stuff and contribute changes. If the +s going on, modify stuff and contribute changes. If the +Let's see if this works. Chapter Three is about the branching model in Git, ofte
  • 366. File Filtering
  • 367. Staging Area fileA.txt fileB.txt fileC.rb
  • 368. Staging Area *.txt Filter smudge fileA.txt clean fileB.txt fileC.rb
  • 369. Staging Area *.txt Filter smudge fileA.txt clean fileB.txt fileC.rb git checkout
  • 370. Staging Area Working Directory *.txt Filter smudge fileA.txt' fileA.txt fileB.txt' fileB.txt clean fileC.rb fileC.rb git checkout
  • 371. Staging Area Working Directory *.txt Filter smudge fileA.txt' fileA.txt fileB.txt' fileB.txt clean fileC.rb fileC.rb
  • 372. Staging Area Working Directory *.txt Filter smudge fileA.txt' fileA.txt fileB.txt' fileB.txt clean fileC.rb fileC.rb git commit
  • 373. Staging Area Working Directory *.txt Filter smudge fileA.txt' fileA.txt fileB.txt' fileB.txt clean fileC.rb fileC.rb git commit
  • 374. expanding a $Date$
  • 375. /usr/bin/expand_date #! /usr/bin/env ruby data = STDIN.read date = `git log --pretty=format:quot;%adquot; -1` puts data.gsub('$Date$', '$Date: ' + date + '$')
  • 376. git config filter.dater.smudge expand_date git config filter.dater.clean 'perl -pe quot;s/$Date[^$]*$/$Date$/quot;'
  • 377. git config filter.dater.smudge expand_date git config filter.dater.clean 'perl -pe quot;s/$Date[^$]*$/$Date$/quot;' replace $Date(whatever)$ with $Date$
  • 378. git config filter.dater.smudge expand_date git config filter.dater.clean 'perl -pe quot;s/$Date[^$]*$/$Date$/quot;' replace $Date(whatever)$ with $Date$
  • 379. test it
  • 380. $ echo '# $Date$' > date_test.rb $ echo 'date*.rb filter=dater' >> .gitattributes $ git add date_test.rb .gitattributes $ git commit -m quot;Testing date expansion in Gitquot; $ rm date_test.rb $ git checkout date_test.rb $ cat date_test.rb # $Date: Tue Apr 21 07:26:52 2009 -0700$
  • 381. $ echo '# $Date$' > date_test.rb $ echo 'date*.rb filter=dater' >> .gitattributes $ git add date_test.rb .gitattributes $ git commit -m quot;Testing date expansion in Gitquot; $ rm date_test.rb $ git checkout date_test.rb $ cat date_test.rb # $Date: Tue Apr 21 07:26:52 2009 -0700$
  • 382. $ echo '# $Date$' > date_test.rb $ echo 'date*.rb filter=dater' >> .gitattributes $ git add date_test.rb .gitattributes git the ‘dater’ filter for any files matching ‘date*.rb’ use commit -m quot;Testing date expansion in Gitquot; $ $ rm date_test.rb $ git checkout date_test.rb $ cat date_test.rb # $Date: Tue Apr 21 07:26:52 2009 -0700$
  • 383. $ echo '# $Date$' > date_test.rb $ echo 'date*.rb filter=dater' >> .gitattributes $ git add date_test.rb .gitattributes $ git commit -m quot;Testing date expansion in Gitquot; $ rm date_test.rb $ git checkout date_test.rb $ cat date_test.rb # $Date: Tue Apr 21 07:26:52 2009 -0700$
  • 384. $ echo '# $Date$' > date_test.rb $ echo 'date*.rb filter=dater' >> .gitattributes $ git add date_test.rb .gitattributes $ git commit -m quot;Testing date expansion in Gitquot; $ rm date_test.rb $ git checkout date_test.rb $ cat date_test.rb # $Date: Tue Apr 21 07:26:52 2009 -0700$
  • 385. $ echo '# $Date$' > date_test.rb $ echo 'date*.rb filter=dater' >> .gitattributes $ git add date_test.rb .gitattributes $ git commit -m quot;Testing date expansion in Gitquot; $ rm date_test.rb $ git checkout date_test.rb $ cat date_test.rb # $Date: Tue Apr 21 07:26:52 2009 -0700$
  • 386. $ echo '# $Date$' > date_test.rb $ echo 'date*.rb filter=dater' >> .gitattributes $ git add date_test.rb .gitattributes $ git commit -m quot;Testing date expansion in Gitquot; $ rm date_test.rb $ git checkout date_test.rb $ cat date_test.rb # $Date: Tue Apr 21 07:26:52 2009 -0700$
  • 387. </tricks></tips>
  • 388. one more thing...
  • 389. 2
  • 390. git server hg client hg client git client
  • 391. hg-git.github.com
  • 392. http://bitbucket.org/Scotty/hg-git/
  • 393. http://github.com/schacon/hg-git
  • 394. $ hg gpush github pushing to : github exporting git objects converting revision 78 creating and sending data github::refs/heads/master : f8cebef6 => ffbc960d
  • 395. beta
  • 396. • lossless conversion • all pushes to GitHub for the project have been through Hg • have pulled and merged changes introduced on GitHub via Hg • have pulled and merged changes introduced on BitBucket and pushed back to GitHub
  • 397. hg-git.github.com
  • 398. fin
  • 399. Resources git-scm.com gitcasts.com learn.github.com #git / #github on IRC peepcode - git book and screencast schacon@gmail.com me, in person, tonight, someplace that serves whiskey