Top Banner
Telling stories through your commits BY JOEL CHIPPINDALE AT LRUG IN JANUARY 2015 CC BY-SA 4.0
51

Telling stories through your commits

Aug 04, 2015

Download

Software

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Telling stories through your commits

Telling stories through your commitsBY JOEL CHIPPINDALE AT LRUG IN JANUARY 2015

CC BY-SA 4.0

Page 2: Telling stories through your commits

Not about Ruby

Page 3: Telling stories through your commits

Not even about git

Page 4: Telling stories through your commits

Managing complexity

by Cory Doctorow (CC BY-SA)

Page 5: Telling stories through your commits

Your commit history is…

Page 6: Telling stories through your commits

Kept forever

Page 7: Telling stories through your commits

Always up to date

Page 8: Telling stories through your commits

Searchable

Page 9: Telling stories through your commits

$ git log --grep='Commit contents'

Page 10: Telling stories through your commits

$ git log -S 'Diff contents'

Page 11: Telling stories through your commits

$ git blame

Page 12: Telling stories through your commits
Page 13: Telling stories through your commits

“Every line of code is always documented”

- Mislav Marohnić

from http://mislav.uniqpath.com/2014/02/hidden-documentation/

Page 14: Telling stories through your commits

5 Principles

by Umberto Rotundo (CC BY)

Page 15: Telling stories through your commits

1. Make atomic commits

by lupusphotos (CC BY)

Page 16: Telling stories through your commits

$ git log --shortstat commit: [REDACTED] Author: [REDACTED] Date: [REDACTED]

bug fixes and wp 4.0.1 update

1377 files changed, 175405 insertions(+), 248 deletions(-)

Page 17: Telling stories through your commits

What if this commit had been split up?

Page 18: Telling stories through your commits

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

Page 19: Telling stories through your commits

Minimum viable commit

Page 20: Telling stories through your commits

Avoid ‘and’ in commit messages

Page 21: Telling stories through your commits

Make atomic commits so that you can

make sense of your commits

Page 22: Telling stories through your commits

2. Write good commit messages

by Ginny (CC BY-SA)

Page 23: Telling stories through your commits

What does good look like?

Page 24: Telling stories through your commits

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.

Page 25: Telling stories through your commits

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.

Page 26: Telling stories through your commits

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.

Page 27: Telling stories through your commits

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.

Page 28: Telling stories through your commits

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.

Page 29: Telling stories through your commits

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/

Page 30: Telling stories through your commits

Write good commit messages (including why and the context)

so that you can make sense of your commits

Page 31: Telling stories through your commits

3. Revise history before sharing

by hoodedfang (CC BY-NC)

Page 32: Telling stories through your commits

$ git rebase --interactive

Page 33: Telling stories through your commits

Remove, reorder, edit, merge and split commits

Page 34: Telling stories through your commits

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

Page 35: Telling stories through your commits

$ git rebase --interactive master

Page 36: Telling stories through your commits
Page 37: Telling stories through your commits
Page 38: Telling stories through your commits

1bd241c Remove Bar 773e345 Add Foo

Page 39: Telling stories through your commits

Rewrite history before sharing so that your collaborators can make sense of your commits

Page 40: Telling stories through your commits

4. Use single purpose branches

by Jon Bennet (CC BY)

Page 41: Telling stories through your commits

When you take a diversion move the work off the branch

Page 42: Telling stories through your commits

Use single purpose branches so that you can

make sense of your current work

Page 43: Telling stories through your commits

5. Keep your history linear

Page 44: Telling stories through your commits
Page 45: Telling stories through your commits

Rebase before you merge

Page 46: Telling stories through your commits
Page 47: Telling stories through your commits

$ git merge --no-ff

Page 48: Telling stories through your commits

Keep your history linear so that you can make sense of it

Page 49: Telling stories through your commits

1. Make atomic commits 2. Write good commit messages 3. Revise history before sharing 4. Use single purpose branches 5. Keep your history linear