Skip to content

Instantly share code, notes, and snippets.

@warpech warpech/
Created Nov 24, 2017

What would you like to do?
Commit messages

Commit Messages

Commit messages should say why you made a change, not what you changed.

A good commit message has the following:

  • explanation of the problem
  • explanation of the solution
  • reference to the relevant GitHub issue

The reference to the GitHub issue can be made as a URL or in a short form: #issue (e.g. #12). If you refer to an issue from another repo, use org/repo#issue (e.g. StarcounterAps/Launchpad#12). GitHub recognizes this pattern and shows a cross-reference.

This is a bad commit message:


To write a good commit message that doesn't miss any of the above points you can use the following template. It splits the message into two parts: the problem and the solution. The problem description is in the headline, followed by the explanation why you are making this change. The solution part can be really short because the diff itself is the solution.

Problem: Some elements do not display starting from starcounter-include 3.0.0

This is because they have a slot attribute but there is no respective slot
element in the declarative Shadow DOM (

Solution: Add missing slot elements to declarative shadow DOM

With such a commit messages, the description of your Pull Request can almost be empty!

Changing the message after committing

If you have not yet pushed your commits, you can still edit the commit messages.

To edit the commit message of the last commit, you can simply change it using git commit --amend. Sourcetree and other Git GUIs also give an option to amend a previous commit.

To edit commit messages of any commit you can use Git interactive rebase:

Never change commits that have been pushed!

More info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.