Slide 1

Slide 1 text

% git commit -asm “Write better commit messages.” Friday, August 17, 12

Slide 2

Slide 2 text

Typical Commit Message $ git log --no-merges commit 8c052211839afc7373026308e8bda74721e04adc Author: Everybody Ever Date: Wed Aug 15 00:09:29 2012 -0700 fixed some bugs Friday, August 17, 12

Slide 3

Slide 3 text

What’s that? wrong with Friday, August 17, 12

Slide 4

Slide 4 text

Have A SUMMARY Friday, August 17, 12

Slide 5

Slide 5 text

But be DESCRIPTIVE Friday, August 17, 12

Slide 6

Slide 6 text

Have a good summary (but brief) Better Commit Messages Friday, August 17, 12

Slide 7

Slide 7 text

Better Commit Messages Have a more descriptive body using the present imperative tense (in other words, commands) Friday, August 17, 12

Slide 8

Slide 8 text

commit 30b6769ff4b0cae0272a9d48c3397c0fdc7987ee Author: David Celis Date: Wed Aug 15 00:09:29 2012 -0700 Summary of changes (< 50 characters) If necessary (helpful on a team), a more descriptive and verbose summary of changes. The body of the commit message should be wrapped to 72 characters for proper formatting during a `git log`. Use the imperative present tense (i.e. commands). Instead of saying something like "Fixed a few bugs for..." or "Fixing a few bugs for...", say "Fix a few bugs for..." # ... Better Commit Messages Friday, August 17, 12

Slide 9

Slide 9 text

Separate paragraphs with line breaks Better Commit Messages Friday, August 17, 12

Slide 10

Slide 10 text

commit 30b6769ff4b0cae0272a9d48c3397c0fdc7987ee Author: David Celis Date: Wed Aug 15 00:09:29 2012 -0700 # ... Unless you omit the body of the commit message, the blank line between it and the subject is critical. Tools such as `git-rebase` will get confused if the two run together. It is typical to separate paragraphs within the body by blank lines as well, just as you would while writing anything else. # ... Better Commit Messages Friday, August 17, 12

Slide 11

Slide 11 text

Know their context! Better Commit Messages Friday, August 17, 12

Slide 12

Slide 12 text

commit 30b6769ff4b0cae0272a9d48c3397c0fdc7987ee Author: David Celis Date: Wed Aug 15 00:09:29 2012 -0700 # ... Depending on the context of the commit message, the subject line and body will be treated differently. For instance: * In a GitHub pull request, the first line becomes the subject. The rest of the message will be parsed for Markdown, which is awesome. * In an email, the first line becomes the subject and the rest of the commit message becomes the body. * Hyphens are also okay for bulleted lists. Precede all bullets by one space. # ... Better Commit Messages Friday, August 17, 12

Slide 13

Slide 13 text

commit 30b6769ff4b0cae0272a9d48c3397c0fdc7987ee Author: David Celis Date: Wed Aug 15 00:09:29 2012 -0700 # ... Finally, code should be indented by four spaces in any context. Signed-off-by: David Celis Better Commit Messages Friday, August 17, 12

Slide 14

Slide 14 text

Awesome commit messages Make for happier collaborators Friday, August 17, 12

Slide 15

Slide 15 text

@davidcelis Signed-off-by: Friday, August 17, 12