Skip to main content

GIT - switch/check last branch name

Switch to previous branch

git checkout @{-1}

Or short alias:

git checkout -

Check last five branches:

git for-each-ref refs/heads/ --sort=-committerdate --format=%(refname:short) --count=5


Add new comment


This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

We use cookies on our website to enhance your user experience. We also use Google analytics and ads.

Click here to read more I've read it