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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s