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.

Aaa2b1f12b65d33422e8cdc48d70c0f9?s=128

Stephen Ball

August 17, 2013
Tweet

Transcript

  1. 2.

    Git

  2. 10.
  3. 11.
  4. 13.
  5. 16.
  6. 17.

    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).
  7. 18.

    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).
  8. 19.

    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).
  9. 20.

    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).
  10. 36.

    Git Commits are always in sync Commits are tied to

    the change They’re comments that expire (automatically)
  11. 40.
  12. 46.

    $ git rev-list master..feature | wc -l 37 $ git

    rebase -i 1123e81 [magic happens] (ů◕‿◕)ů*:ŋƅ✧
  13. 47.

    $ git rev-list master..feature | wc -l 37 $ git

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

    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!
  15. 49.

    $ 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
  16. 50.

    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.
  17. 51.

    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.
  18. 52.

    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.
  19. 53.

    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
  20. 55.

    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