Skip to content

Instantly share code, notes, and snippets.

@indexzero
Last active December 21, 2017 14:05
Show Gist options
  • Save indexzero/fad0761234ff3f121a78317a09373f78 to your computer and use it in GitHub Desktop.
Save indexzero/fad0761234ff3f121a78317a09373f78 to your computer and use it in GitHub Desktop.
My thoughts on Git commit structure

Git commit prefixes

When possible it is preferable to break up your commits into smaller digestable chunks so that they are more readable during the peer review process. One way to accomplish this is by using a known set of git commit prefixes.

  • [api]: New apis / changes to apis
  • [test]: Update test/* files
  • [dist]: Changes to submodules, version bumps, updates to package.json
  • [tiny]: Small changes#
  • [doc]: Updates to documentation
  • [ux]: Updates to UX
  • [fix]: Bug fixes
  • [bin]: Update binary scripts associated with the project
  • [merge]: Resolved git merge from upstream or otherwise
  • [refactor]: Refactor of existing code with no external API changes
  • [{{ feature }}]: Updates {{ feature }}

For example if you had done work on a new API for your project and added tests your commit would look something like this:

git add some-file.js
git add test/some-file.test.js
git commit -m '[api test] Added some feature along with associated tests.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment