Search code examples
gitgit-reflog

When does git reflog command show HEAD->master and when not


I am learning git, and used the git reflog command. I have a doubt. When I run it, for some entries I see the HEAD->master written after the commit hash. But it is not written in front of all the commits. My question is, is this of any significance? Why does it occur only at some places and not at all of the commits?

930f601 (HEAD -> master) HEAD@{0}: checkout: moving from b161f2ced6e956e362b39fbd091d397e1cc96503 to master
b161f2c HEAD@{1}: checkout: moving from master to b161f2ced6e956e362b39fbd091d397e1cc96503
930f601 (HEAD -> master) HEAD@{2}: checkout: moving from 4900500a6723ff01c631bff19a77ec45e2559349 to master
4900500 HEAD@{3}: checkout: moving from master to 4900500a6723ff01c631bff19a77ec45e2559349
930f601 (HEAD -> master) HEAD@{4}: reset: moving to 930f601b14d7051b7b97b1a98bd663ff272f5392
4900500 HEAD@{5}: commit: added more lines to file 1
930f601 (HEAD -> master) HEAD@{6}: commit: modified file 1
b161f2c HEAD@{7}: commit: added content to file
18d0dcc HEAD@{8}: commit (initial): added file 1

I have added a sample code to show what I intend to mean. Please let me know if this information is not sufficient. I'll add more


Solution

  • It's called decorations.

    git reflog show (default mode) accepts log options.

    Commits which happen to have a tag or a branch (or HEAD) pointing at them feature these decorations by default config but you can set it on or off for most types of output, like git log (option --decorate, and config log.decorate).