# 输出 To git@github.com/example.git - [deleted] v1.0
代码切换到指定标签
使用 git checkout 命令,可以使代码回到指定的标签位置,但此时会处于 detached HEAD 状态:
git checkout
$ git checkout v1.0
# 输出 Note: switching to 'v1.0'.
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 switching back to a branch.
If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:
git switch -c <new-branch-name>
Or undo this operation with:
git switch -
Turn off this advice by setting config variable advice.detachedHead to false