gpt4 book ai didi

git log 命令不显示 HEAD 信息

转载 作者:行者123 更新时间:2023-12-01 12:03:07 32 4
gpt4 key购买 nike

我正在创建一个 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 日志输出如下(HEAD 指向 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

如果我遗漏了什么,请告诉我。谢谢

最佳答案

您可能在此处有不同的配置条目。参见 log.decorate

但是无论如何,要在日志输出中的提交散列之后明确提及分支/标签信息,请使用标志

# to force it
git log --decorate

# to prevent it
git log --no-decorate

正如 torek 在评论 below 中指出的那样,阈值更准确地说是 1.7.2 版本,其中 log.decorate 一起出现。在那之前,根本没有装饰,从那时起它默认为 auto(意味着它默认打开)。

关于git log 命令不显示 HEAD 信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60060533/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com