Top Banner
Commit Messages Good Practices by Tarin Gamberini www.taringamberini.com CC BY-NC-SA 3.0
33

Commit messages - Good practices

Sep 08, 2014

Download

Technology

Tarin Gamberini

An extremely little set of rules to write good commit messages.

History (how code changes over time) become a very useful tool if associated with good commit messages.

These slides would make developers more aware about how good commit messages could improve their work.
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: Commit messages - Good practices

Commit MessagesGood Practices

byTarin Gamberini

www.taringamberini.comCC BY-NC-SA 3.0

Page 2: Commit messages - Good practices

Abstract

An extremely little set of rules to write good commit messages.

History (how code changes over time) become a very useful tool if associated with good commit messages.

These slides would make developers more aware about how good commit messages could improve their work.

Page 3: Commit messages - Good practices

Usually do not writecommit messages

I have said to my catthat some developersusually do not writecommit messagesMy cat could not belive it ...

Page 4: Commit messages - Good practices

UsuallyDo Not writecommitMessages?!?

Page 5: Commit messages - Good practices

Commit MessagesWhy?

Commit Messages Why?

Page 6: Commit messages - Good practices

Any software project is a collaborative project

Any software project has at least two developers ...

Commit Messages Why?

Page 7: Commit messages - Good practices

… theoriginal developer

... theoriginal developer

few months later

Commit Messages Why?

Page 8: Commit messages - Good practices

Because when some poor maintainer is

hunting a bug and finds that it was added in revision xyz, he will want to know ...

Commit Messages Why?

Page 9: Commit messages - Good practices

Commit Messages Why?

… what revision xyz was supposed to do

Page 10: Commit messages - Good practices

Commit Messages Why?

Because when some requirement can be

implemented in

several ways the responsible developer will write, in revision xyz ...

Page 11: Commit messages - Good practices

Commit Messages Why?

… why revision xyz was implemented in that way

Page 12: Commit messages - Good practices

Commit Messages Why?

Because when the boss

wants to know why

a functionality was added, and the developer finds

that happened in revision xyz, the developer will want to know ...

Page 13: Commit messages - Good practices

Commit Messages Why?

… why revision xyz was added

Page 14: Commit messages - Good practices

Commit MessagesHow?

Commit Messages hOW?

Page 15: Commit messages - Good practices

The following hints are

based on experiencedoing code development,bug troubleshooting and code review across a number

of projects using GIT

Examination of other projectsSuch as the Kernel, CoreUtils,GNULIB and more suggested

they all follow a fairly

common practice

Commit Messages hOW?

Page 16: Commit messages - Good practices

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

[

Commit Messages hOW?

The first line

Page 17: Commit messages - Good practices

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Imperative

[ !!!

Commit Messages hOW?

The first line

Page 18: Commit messages - Good practices

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

50

Imperative

Should belimited to50 chars

[ !!!

Commit Messages hOW?

The first line

Page 19: Commit messages - Good practices

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

50

Imperative

Should belimited to50 chars

Shouldnot end

with a period

[ !!!

Commit Messages hOW?

The first line

Page 20: Commit messages - Good practices

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Commit Messages hOW?

The second line

[

Page 21: Commit messages - Good practices

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Commit Messages hOW?

The second line

[

Should beblank

Page 22: Commit messages - Good practices

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Commit Messages hOW?

The second line

[

Should beblank

Further paragraphscame after a blank line

[

Page 23: Commit messages - Good practices

[

Subsequential lines

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Commit Messages hOW?

Page 24: Commit messages - Good practices

[

72

Subsequential linesShould belimited to72 chars Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Commit Messages hOW?

Page 25: Commit messages - Good practices

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

[

72

Original

problem Why

wHy

whY limita

tions

If any

Subsequential linesShould belimited to72 chars

Detailed description of

the change

Commit Messages hOW?

Page 26: Commit messages - Good practices

[

Commit Messages hOW?

External references

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Page 27: Commit messages - Good practices

[

Commit Messages hOW?

External referencesDo not assume

availabilityof external resources

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Page 28: Commit messages - Good practices

[

Commit Messages hOW?

External referencesDo not assume

availabilityof external resources

Bug tracking integration

Switch libvirt get_cpu_info method over to use config APIs

The get_cpu_info method in the libvirt driver currently uses XPathqueries to extract information from the capabilities XML document. Switch this over to use the new config class LibvirtConfigCaps. Also provide a test case to validate the data being returned.

Closes-Bug: #1003373Implements: blueprint libvirt-xml-cpu-modelChange-Id: I4946a16d27f712ae2adf8441ce78e6c0bb0bb657

Page 29: Commit messages - Good practices

Usually writecommit messages

I have said to my cat

that now those developersare getting used to writing

amazing commit messagesMy cat was astonished ...

Page 30: Commit messages - Good practices

Amazingcommit messages

Page 31: Commit messages - Good practices

BibliographyWhy should I write a commit message?

http://programmers.stackexchange.com/questions/52267/why-should-i-write-a-commit-message

GIT Commit Good Practicehttps://wiki.openstack.org/wiki/GitCommitMessages

A Note About Git Commit Messageshttp://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

Best Practices for Version Controlhttp://blog.looplabel.net/2008/07/28/best-practices-for-version-control/

On commit messageshttp://who-t.blogspot.de/2009/12/on-commit-messages.html

Subversion Best Practiceshttp://svn.apache.org/repos/asf/subversion/trunk/doc/user/svn-best-practices.html

Redmine - Administration Guide - Referencing issues in commit messageshttp://www.redmine.org/projects/redmine/wiki/RedmineSettings#Referencing-issues-in-commit-messages

Is Multiple-Column Online Text Better? It Depends!http://psychology.wichita.edu/surl/usabilitynews/72/columns.asp

Page 32: Commit messages - Good practices

Images attributionSlide 4

“frightened cat” from Simon Video athttp://www.simonvideo.com/iphone-ipod-touch/how-to-downgrade-your-iphone-os-4-0-beta-3g-on-a-mac/

Slide 7“the original developer” from High Cats Wallpapers Quality athttp://daveandmonicamunson.blogspot.it/2012/04/high-cats-wallpapers-quality.html“the original developer few month later” from Fun and Fitness at Fifty athttp://fitnessandfunatfifty.wordpress.com/2012/12/07/where-the-heck-did-i-hide-those-presents/forgetful-cat/

Slide 9“hunting a bug” from Movie Posters – feedio.net athttp://img.thesun.co.uk/multimedia/archive/01249/Monkey-massaging-c_1249605a.jpg

Slide 11“orange cat” from Fanpop athttp://www.fanpop.com/clubs/think-different/images/31463891/title/orange-cat-photo

Page 33: Commit messages - Good practices

Images attributionSlide 13

“the boss wants to know” from HD Wallpapers, Images and Photos athttp://hdwallpaperen.com/wp-content/uploads/2013/09/Funny-Baby-And-Cat-HD-Wallpaper.jpg

Slide 15“git logo” from SILICON ANGLE athttp://siliconangle.com/blog/2012/07/09/social-network-for-developers-github-raises-monster-series-a-round-funding-100m/

Slide 30“astonished cat” from Can it be Saturday Now athttp://canitbesaturdaynow.com/images/fpics/3244/1264885670882__large.jpg