Git With It - Version Control Best Practices

It’s a lazy Saturday afternoon before Thanksgiving and I’m reading about Version Control Best Practices, thrilling, right? But in all seriousness, I’ve realized both how vital and helpful, yet confusing, version control can be for a project.

We’ve been working on our first project for about a week (I think? Time sort of flies while doing this bootcamp). I’m really itching to continue development, but I feel the need to take a step back and really dive deep into the recommended workflow for Git before continuing.

I’ve been using the basics of Git staging and committing enough to run into situations where I’d like to read up a bit more on some advanced best practices – especially regarding using branches to build out new features or fix bugs. So far, we’ve only just been working mainly in the master branch (at least I have been =p).

Some points that should be ‘common sense,’ yet that I’ve found helpful are:

  • Use present tense for for commit messages to be consistent with generated messages from commands like git merge
  • Commits should be a wrapper for related changes – two separate fixes should be two separate changes
  • The better and more carefully crafted the commits, the more useful version control will be
  • Good commit messages should answer two questions: - What was the motivation for the change?
  • How does it differ from the previous version?
  • Test before committing!
  • Don’t commit half-done work. Use git stash to save unfinished work

Duncan Leung

Front End Developer at

Irvine, CA

Subscribe to Duncan Leung: Javascript and Front End Development

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!