How to checkout a previous Tag in Git

Say you have a project and have been tagging particular points of it on the command line using

Sometime later you’d like to go back to such a tag. This is how we can do that.

First, commit your current changes so that you’re free to checkout anything new without losing your hard work. Then simply type

assuming that v1.0 is the name of your tag. Sometimes you may want to checkout this tag and create a new branch while you’re at it, so that your current branch won’t be overwritten. Thankfully we can do this by issuing

This will create a new branch called NewBranch and checkout tag v1.0. Once you’re done working on it you can go back to another branch (for example master) by issuing

Notice that to switch to other branches you only need to give the branch name – unlike with tags which need to be prefixed with ‘tags/’ as shown above.

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.