Thursday, December 18, 2014

Git Tip of the Year: Switch to the Previous Branch

Okay, you're working on a branch called 'awesome'. You switch to a branch 'master'. You merge 'awesome' into 'master'

How do you switch back to 'awesome'?
Use git checkout - to switch to the previous branch.
# suppose we're at the branch 'master' now
$ git checkout -
Switched to branch 'awesome'
# now let's go back to master
$ git checkout -
Switched to branch 'master'
Yeah, that's pretty similar to a good old cd -.

No comments:

Post a Comment