Simple testing of different Git commits

I use branches a lot with Git, as I find them easy to understand and a great tool for organizing. If you want to easily switch back and forth between versions of your code base for testing, you can just create a branch with a particular commit:

git checkout -b before-refactor a8b912c0ebdce6173f6e7af5d93fafc0f50175c0

This also lets you easily compare versions by diffing the branches:

git diff master before-refactor

Published by

Kirk Wight

I am a WordPress developer working at Automattic (the makers of WordPress.com). Based in Vancouver, BC, Canada, I am easily distracted and very curious.