Change to last Git branch

A normal git workflow often involves switching between two git branches: create a feature branch off of master, switch back to master to get the latest version, switch to the feature branch to rebase, and switch to master to merge.

Git provides a handy shortcut to switch back to the last branch: $ git checkout –

This is similar to the Unix syntax to switch back to the last directory: $ cd –

Linus Torvalds is the original author of Git and Linux, so it is no surprise that the shortcut commands are similar.

Advertisements

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