Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deliberate Git

Deliberate Git

Many teams see Git as a source of frustration. A painful reminder that the rubber needs to meet the road in order to make ends meet and keep our customers happy. They see Git as just a mechanism to transport the code from development machines to production servers and keep everyone in sync.

But I want Git to do more. Being distributed means Git gives us the opportunity to do something really amazing. It allows us to make quick commits locally without breaking flow and then allows us to rewrite those commits into a cohesive story that we share with our team.

This talk describes what makes commits awesome and how you can write them and still keep a good coding flow.

Stephen Ball

August 17, 2013
Tweet

More Decks by Stephen Ball

Other Decks in Programming

Transcript

  1. Git

  2. Replace lead tracking Foo with Bar Foo’s API has dropped

    5 out of the last 27 emails since we started keeping our own logs. Their support is not responding. Fred and I decided to drop in Lead Engine B after checking alternatives (see wiki:LeadEngineResearch).
  3. Replace lead tracking Foo with Bar Foo’s API has dropped

    5 out of the last 27 emails since we started keeping our own logs. Their support is not responding. Fred and I decided to drop in Lead Engine B after checking alternatives (see wiki:LeadEngineResearch).
  4. Replace lead tracking Foo with Bar Foo’s API has dropped

    5 out of the last 27 leads since we started keeping our own logs. Their support is not responding. Fred and I decided to drop in Lead Engine B after checking alternatives (see wiki:LeadEngineResearch).
  5. Replace lead tracking Foo with Bar Foo’s API has dropped

    5 out of the last 27 emails since we started keeping our own logs. Their support is not responding. Fred and I decided to drop in Lead Engine B after checking alternatives (see wiki:LeadEngineResearch).
  6. Git Commits are always in sync Commits are tied to

    the change They’re comments that expire (automatically)
  7. $ git rev-list master..feature | wc -l 37 $ git

    rebase -i 1123e81 [magic happens] (ů◕‿◕)ů*:ŋƅ✧
  8. $ git rev-list master..feature | wc -l 37 $ git

    rebase -i 1123e81 [magic happens] (ů◕‿◕)ů*:ŋƅ✧ $ git rev-list master..feature | wc -l 5
  9. Using “git rebase -i” Use “git log” to find the

    commit before the first commit you want to change. “git rebase -i [that commit’s hash] Magic time!
  10. $ git l * 193bn13 WIP switch fizz to bazz

    * 6a0b73a WIP support fizz * aa02d1e WIP Start to hack out foo * 3a049ba Allow creating users via JSON $ git rebase -i 3a049ba
  11. pick aa02d1e WIP Start to hack out foo pick 6a0b73a

    WIP support fizz pick 193bn13 WIP switch fizz to bazz # Rebase 31049ba..193bn13 onto 31049ba # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom.
  12. pick aa02d1e WIP Start to hack out foo pick 6a0b73a

    WIP support fizz pick 193bn13 WIP switch fizz to bazz # Rebase 31049ba..193bn13 onto 31049ba # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom.
  13. reword aa02d1e WIP Start to hack out foo fixup 6a0b73a

    WIP support fizz fixup 193bn13 WIP switch fizz to bazz # Rebase 31049ba..193bn13 onto 31049ba # # Commands: # p, pick = use commit # r, reword = use commit, but edit the commit message # e, edit = use commit, but stop for amending # s, squash = use commit, but meld into previous commit # f, fixup = like "squash", but discard this commit's log message # x, exec = run command (the rest of the line) using shell # # These lines can be re-ordered; they are executed from top to bottom.
  14. Add foo feature with bazz support The ability to foo

    has been requested by various users. This implementation will allow foo with support for the bazz protocol. At first we thought that the fizz protocol would be a good fit, but that wasn’t the case when we tested it against over 10,000 interactions. We opened up an issue with the fizz API. - The bazz protocol: http://example.com/bazz - fizz api failure issue: http://example.com/issue/12
  15. Git History Commands git log git log -p git log

    --grep=”commit contents” git log -S”diff contents” git log -- path/or/file git blame FILENAME