我正在创建一个git仓库,并使用git commit
将文件添加到仓库中。
提交后在git log
中,我可以看到提交信息,但无法看到HEAD
信息。以下是我遵循的步骤:
$ 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
在另一台机器上,按照相同的步骤创建了仓库后,我可以看到如下的git log输出(HEAD指向主分支):
$ git log
commit 7ba4781ddee49a3636ee700fe057c3a372502460 (HEAD -> master)
Author: abc <abc@abc.com>
Date: Mon Feb 3 22:01:11 2020 +0530
first commit in NonBareRepo
请告诉我如果我漏掉了什么。谢谢。
.config
文件中都没有看到它 :)) - mimikrijalog.decorate
设置为auto
(或者是true
? 或其他什么...)。如果你使用的机器上的Git版本为1.7.1或更早,那么你根本没有log.decorate
。(编辑:事实上,我不确定当时它是否是"auto"。从Git 2.13的一个提交中可以看出,在2.13中修复了默认"auto"模式的错误,但何时变成"auto"则不太清楚。) - torek