I am creating a git repository and adding a file to the repository using git commit
.
After commit in the git log
, I could see the commit info but i am not able to see the HEAD
info. Following is the steps that I followed:
$ git config --global user.name "abc"
$ git config --global user.mail "abc@abc.com"
$ git init
Initialized empty Git repository in /home/aishwarya/github.com/temp/.git/
$ touch a.txt
$ git add a.txt
$ git commit --message "first commit in NonBareRepo"
[master (root-commit) 6d46130] first commit in NonBareRepo
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 a.txt
$ git log
commit 6d46130416eef0104408d575d8d4958457fe1dab
Author: abc <abc@abc.com>
Date: Mon Feb 3 22:07:18 2020 +0530
first commit in NonBareRepo
On other machine, after creating repository with the same steps, I could see the git log output as follows(HEAD points to master):
$ git log
commit 7ba4781ddee49a3636ee700fe057c3a372502460 (HEAD -> master)
Author: abc <abc@abc.com>
Date: Mon Feb 3 22:01:11 2020 +0530
first commit in NonBareRepo
Please let me know if I am missing something. Thank you
You might have different config entries here. See log.decorate
But anyway, to explicitly mention branch/tag info after the commit hash in log output, use the flags
# to force it
git log --decorate
# to prevent it
git log --no-decorate
As torek points out in comment below, the threshold is more precisely 1.7.2
version, where log.decorate
appeared altogether. Before that point, there were no decorations at all, and since then it defaults to auto
(meaning it's turned on by default).