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

Telling stories through your commits - Lead Developer Conference 2016

Telling stories through your commits - Lead Developer Conference 2016

A talk about some of the ways that you can improve how you develop code and communicate with your team through your commits.

This was given at the Lead Developer Conference in 2016

See http://blog.mocoso.co.uk/talks/2015/01/12/telling-stories-through-your-commits/ for more details

Joel Chippindale

June 23, 2016
Tweet

More Decks by Joel Chippindale

Other Decks in Programming

Transcript

  1. Telling stories through your
    commits
    JOEL CHIPPINDALE, CTO
    THE LEAD DEVELOPER CONFERENCE
    JUNE 2016
    @JOELCHIPPINDALE

    View Slide

  2. @joelchippindale
    Our key challenge is
    managing complexity

    View Slide

  3. @joelchippindale
    Naming

    View Slide

  4. @joelchippindale
    Code design

    View Slide

  5. @joelchippindale
    Refactoring

    View Slide

  6. @joelchippindale
    Automated tests

    View Slide

  7. @joelchippindale
    “The primary goal of a
    software developer should be
    to communicate their intent
    to future developers”
    - Louise Crow

    View Slide

  8. @joelchippindale
    Version control system

    View Slide

  9. @joelchippindale
    Your commit history is…

    View Slide

  10. @joelchippindale
    Kept forever

    View Slide

  11. @joelchippindale
    Always up to date

    View Slide

  12. @joelchippindale
    Searchable

    View Slide

  13. $ git log --grep='Commit contents'

    View Slide

  14. $ git log -S 'Diff contents'

    View Slide

  15. $ git blame

    View Slide

  16. Put your section title

    View Slide

  17. “Every line of code is always
    documented”
    - Mislav Marohnić
    from http://mislav.uniqpath.com/2014/02/hidden-documentation/

    View Slide

  18. @joelchippindale
    Three principles

    View Slide

  19. by lupusphotos (CC BY)
    1.
    Make atomic
    commits

    View Slide

  20. $ git log --shortstat
    commit: [REDACTED]
    Author: [REDACTED]
    Date: [REDACTED]
    Bug fixes and WordPress 4.0.1 update
    1377 files changed,
    175405 insertions(+),
    248 deletions(-)

    View Slide

  21. @joelchippindale
    What if this commit had
    been split up?

    View Slide

  22. 21dfe89 Fix category page redirects
    e275479 Fix deletion of author avatars
    d824e02 Fix H2 headers on mobile
    f8e36d4 Fix footer floating bug
    d972537 Fix blog author avatar upload
    d26e788 Remove unused author pages
    7b91091 Fix blog feed
    2f05036 Fix mixed content warnings
    ed21e18 WordPress 4.0.1 update

    View Slide

  23. @joelchippindale
    Minimum viable commit

    View Slide

  24. @joelchippindale
    Avoid ‘and’ in commit
    messages

    View Slide

  25. by Steve Jurvetson (CC BY)
    2.
    Write good
    commit
    messages

    View Slide

  26. @joelchippindale
    What does good look
    like?

    View Slide

  27. Short one line title
    Longer description of what the change
    does (if the title isn’t enough).
    An explanation of why the change is
    being made.
    Perhaps a discussion of context and/or
    alternatives that were considered.

    View Slide

  28. Short one line title
    Longer description of what the change
    does (if the title isn’t enough).
    An explanation of why the change is
    being made.
    Perhaps a discussion of context and/or
    alternatives that were considered.

    View Slide

  29. Short one line title
    Longer description of what the change
    does (if the title isn’t enough).
    An explanation of why the change is
    being made.
    Perhaps a discussion of context and/or
    alternatives that were considered.

    View Slide

  30. Correct the colour of FAQ link in course notice footer
    PT: https://www.pivotaltracker.com/story/show/84753832
    In some email clients the colour of the FAQ link in the
    course notice footer was being displayed as blue instead
    of white. The examples given in PT are all different
    versions of Outlook. Outlook won't implement CSS changes
    that include `!important` inline[1]. Therefore, since we
    were using it to define the colour of that link, Outlook
    wasn't applying that style and thus simply set its default
    style (blue, like in most browsers). Removing that `!
    important` should fix the problem.
    [1] https://www.campaignmonitor.com/blog/post/3143/
    outlook-2007-and-the-inline-important-declaration/

    View Slide

  31. by hoodedfang (CC BY-NC)
    3.
    Revise your
    development
    history before
    sharing

    View Slide

  32. $ git rebase --interactive

    View Slide

  33. @joelchippindale
    Remove, reorder, edit,
    merge and split commits

    View Slide

  34. 324d079 Fix typo in "Add Foo"
    ab2189d Remove Bar
    2a11e7d Add Foo

    View Slide

  35. 1bd241c Remove Bar
    773e345 Add Foo

    View Slide

  36. @joelchippindale
    1. Make atomic commits
    2. Write good commit messages
    3. Revise your history before sharing

    View Slide

  37. @joelchippindale
    “I love our commit messages, I
    don't think I've worked on a
    codebase where it's easier to
    answer the question, ‘huh, why is
    this code here?’”

    View Slide

  38. @joelchippindale
    How do I persuade my
    team to adopt these
    practices?

    View Slide

  39. @joelchippindale
    Won’t it take lots of
    discipline to get a long
    term payoff?

    View Slide

  40. @joelchippindale
    These practices make it
    simpler for individual
    developers now

    View Slide

  41. @joelchippindale
    1. Make atomic commits
    2. Write good commit messages
    3. Revise your history before sharing

    View Slide

  42. @joelchippindale
    Thank you
    @joelchippindale
    [email protected]
    futurelearn.com/blog

    View Slide