Skip to content

Instantly share code, notes, and snippets.

@matthewhudson
Last active December 13, 2023 20:00
Show Gist options
  • Save matthewhudson/1475276 to your computer and use it in GitHub Desktop.
Save matthewhudson/1475276 to your computer and use it in GitHub Desktop.

A good commit message looks like this:

Header line: explaining the commit in one line

Body of commit message is a few lines of text, explaining things
in more detail, possibly giving some background about the issue
being fixed, etc etc.

The body of the commit message can be several paragraphs, and
please do proper word-wrap and keep columns shorter than about
74 characters or so. That way "git log" will show things
nicely even when it's indented.

Reported-by: whoever-reported-it
Signed-off-by: Your Name <[email protected]>

where that header line really should be meaningful, and really should be just one line. That header line is what is shown by tools like gitk and shortlog, and should summarize the change in one readable line of text, independently of the longer explanation.

@yihangho
Copy link

yihangho commented Aug 4, 2013

The link does not point to the correct line. Please update to: https://github.com/torvalds/subsurface/blob/master/README#L272

@yachi
Copy link

yachi commented Dec 16, 2015

@puzanov
Copy link

puzanov commented Jan 26, 2017

huh, seems that all my commits are lame

@heldrida
Copy link

Most common, say as much as possible with the smallest number of characters:

commit msg: fix

@antstorm
Copy link

I think all this points out is that you should format your commit messages to make it easier for the various tools to recognise and display properly. Unless there's a specific underlying format (like markdown or similar) it is the tool's job to figure out how to display the commit message

@manasRK
Copy link

manasRK commented Jan 26, 2017

Woah ! Seems one would have to be careful while making commits with minor big fixes.

Copy link

ghost commented Jan 26, 2017

Beautiful.

@orangle
Copy link

orangle commented Jul 11, 2018

good

@abhijeetps
Copy link

abhijeetps commented Mar 10, 2019

There's a GitHub bot named DCO which checks if the PR follows this commit style: https://probot.github.io/apps/dco/

@alexellis
Copy link

Derek also checks DCO and does other useful tasks for projects https://github.com/alexellis/derek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment