Commit Tips

If you are still using CVS and Subversion or moved on to something distributed its a good idea to keep in mind how to commit.

Commits and commit messages are pretty important. I’ve had single user repos for years and I still put decent messages and commit sensibly in case I need to go back and figure out something.

Here are a few tips that hopefully will help to do better commits.

  • A commit shouldn’t be a number of unrelated things.
  • Each commit should be a single step that you are doing to achieve something.
  • Your commit message should describe just the step you did.
  • No blank commit messages, blank means you did nothing. :)
  • In a traditional VCS like CVS or Subversion always do an update and merge any changes before you commit.
  • In a DVCS like Git or Mercurial commit what you did, then pull, update, merge, commit, and push. (This might change depending on the tool you use.)

If you keep your commits per step you will find you can pick and move, release, make patches or do pull requests easier.