Git checkout tag issues - tag is unchanged

advertisements

I have a few tags in my Git repo:

  • release/20-000RC1
  • release/21-000RC1
  • release/22-000RC1

First I check out release/20-000RC1:


git checkout release/20-000RC1
git status

HEAD detached at release/20-000RC1

Status properly shows release/20-000RC1


Then I check out release/21-000RC1:

git checkout release/21-000RC1
git status

HEAD detached at release/21-000RC1

Status properly shows release/21-000RC1


Now finally I checkout release/22-000RC1, and...

git checkout release/22-000RC1
git status

HEAD detached at release/21-000RC1
nothing to commit, working directory clean

Instead of release/22-000RC1 "git status" shows me release/21-000RC1.

I'm very confused about why after doing checkout of release/22-000RC1 it stays on 21-000RC1 when doing status?


The merge is not the issue, but rather the fact that I do "git checkout release/22-000RC1" and then when I do "git status" it tells me that I'm on release/21-000RC1.

Run the following commands. They will show sha1-s of commits, connected to these tags. Are outputs equal?

git rev-parse release/21-000RC1
git rev-parse release/22-000RC1

If they are equal, then tags are on the same commit. You checkout to release/22-000RC1, which is a commit tagged with release/21-000RC1, and that tag was created earlier, so its name is shown instead.

You can use the following command to list all tags, pointing to the current commit.

git tag --points-at HEAD