Loading...

Update to a specific tag with git

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

Git has the ability to tag specific points in history as being important. Typically people use this functionality to mark release points (v1.0, and so on). Following example demonstrated how to switch to a specific tag with git.

Show available tags for Dropwizard Metrics (output shortened)

$ git tag
v1.0.0
v3.0.0-BETA1
v3.0.0-BETA2
v3.0.0-BETA3
v3.0.0-RC1
v3.0.1
v3.0.2
v3.0.2-dropwizard
v3.1.0
v3.1.1
v3.1.2

Update to tag v3.1.2 without creating a branch

$ git checkout v3.1.2
Note: checking out 'v3.1.2'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
  git checkout -b new_branch_name
HEAD is now at c4b64c5... [maven-release-plugin] prepare release v3.1.2
git
Please remember the terms for blog comments.