From 1e84b850d59140449c6fde3e112c28583cdbc8e4 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Thu, 5 Mar 2015 22:56:09 -0600 Subject: [PATCH] Add Checkout Previous Branch to git til. --- README.md | 1 + git/checkout-previous-branch.md | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 git/checkout-previous-branch.md diff --git a/README.md b/README.md index 5712033..788fb89 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ smart people at [Hashrocket](http://hashrocket.com/). ### git +- [Checkout Previous Branch](git/checkout-previous-branch.md) - [Intent To Add](git/intent-to-add.md) - [Staging Changes Within Vim](git/staging-changes-within-vim.md) - [Stashing Untracked Files](git/stashing-untracked-files.md) diff --git a/git/checkout-previous-branch.md b/git/checkout-previous-branch.md new file mode 100644 index 0000000..44f0031 --- /dev/null +++ b/git/checkout-previous-branch.md @@ -0,0 +1,13 @@ +# Checkout Previous Branch + +Git makes it easy to checkout the last branch you were on. + +```bash +$ git checkout - +``` + +This is shorthand for `git checkout @{-1}` which is a way of referring to +the previous (or last) branch you were on. You can use this trick to easily +bounce back and forth between `master` and a feature branch. + +[source](http://stackoverflow.com/questions/7206801/is-there-any-way-to-git-checkout-previous-branch)