Over a million developers have joined DZone.
Platinum Partner

Quick Switch Between Git Branches

· DevOps Zone

The DevOps Zone is brought to you in partnership with Librato.  Check out Librato's whitepaper on Selecting a Cloud Monitoring Solution.

Today's little-known git feature (or maybe everyone knows but me? I only found this a few months ago) is for quickly switching between branches. Usually I would switch branches with:

git checkout [branchname]

However if you switch from one branch to another and want to switch back again (this happens when I'm reviewing changes and wondering if a bug is present on master as well), then you can do so by just doing:

git checkout -

Just a little timesaver in case it's useful to anyone else - I know I've been using it quite a bit!


Published at DZone with permission of Lorna Mitchell , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}