Am 16.01.24 um 16:30 schrieb Vaibhav Naik: > > Thank you for filling out a Git bug report! > Please answer the following questions to help us understand your issue. > > What did you do before the bug happened? (Steps to reproduce your issue) > i typed this command in order: > git checkout ca35d53 > git tag 1.1.2 > git commit --allow-empty -m "want to commit at any cost" > (i just wanted to commit to catch the bug) > > What did you expect to happen? (Expected behavior) > when I checkout, it was showing the commit id at the place of HEAD Point: > vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((ca35d53...)) > and then after creating a new tag it was showing the tag name at the place of HEAD Point: > vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2)) > which is wrong, that place is to show where the HEAD is pointing at and not the newly created tag name The "it" in "it was showing the tag name" is your prompt, right? It looks like the one provided by contrib/completion/git-prompt.sh. A version of that script is at [1]. It is quite long and configurable, but it shows the output of "git describe --tags --exact-match HEAD" if the HEAD commit is tagged or otherwise its abbreviated hash. Which matches what you see: both your (detached) HEAD and your tag point to commit ca35d53, so the tag name is shown. The idea being that a symbolic name is more meaningful to a reader than a hash value. You just gave that commit a name, so the prompt script uses it. > What happened instead? (Actual behavior) > It showed the newly created tag name at the place of the HEAD Point: > vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((1.1.2)) > > What's different between what you expected and what actually happened? > It should show the the detached HEAD commit id at the place of HEAD Point and not the newly created tag name > I proved this wrong by doing a commit which didn't got committed to any branch or tag but it moved the HEAD: > > vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((newt)) > $ git commit --allow-empty -m "want to commit at any cost" > [detached HEAD caad8ef] want to commit at any cost > > vaibh@VaibhavNaik MINGW64 /d/E Drive/MyCodes/Git-Testing ((caad8ef...)) > $ git status > HEAD detached from ca35d53 > nothing to commit, working tree clean > > it showed the tag name in the brackets git commit moves the HEAD, even if it is detached, true. And you created an untagged commit, so the prompt fell back to showing its abbreviated hash. I don't see how this proves that showing the tag name for a tagged commit is somehow wrong. What would be the benefit? I can understand that prompts are a matter of personal preference, though. You can adjust what the prompt shows by setting the environment variable GIT_PS1_DESCRIBE_STYLE. See git-prompt.sh lines 91 ff. for a description of the recognized values (or check your local version of the script). There's no option to ignore tags and always show the abbreviated hash, though, yet. To summarize: I don't think the behavior you saw indicates a bug, and the prompt style you'd like to use doesn't seem to be implemented, yet. It shouldn't be difficult to add, but I don't quite get why you'd want to shun tags. > > Anything else you want to add: > > Please review the rest of the bug report below. > You can delete any lines you don't wish to share. > > > [System Info] > git version: > git version 2.43.0.windows.1 > cpu: x86_64 > built from commit: 4b968f3ea3b32a7bc50846bab49f3f381841d297 > sizeof-long: 4 > sizeof-size_t: 8 > shell-path: /bin/sh > feature: fsmonitor--daemon > uname: Windows 10.0 22631 > compiler info: gnuc: 13.2 > libc info: no libc information available > $SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe > > > [Enabled Hooks]