gpt4 book ai didi

git - 如何在 `git log` 中的每个提交中显示分支名称

转载 作者:太空狗 更新时间:2023-10-29 13:56:56 25 4
gpt4 key购买 nike

在 Gitk 中,显示提交会产生如下输出:

Author: ...
Committer: ...
Parent: ...auth/parser)
Parent: ... (Merge branch '...')
Child: ...
Branches: remotes/me/foo, foo

有没有办法在 git log 中得到这种输出?使用 git log --graph 提供类似的信息,但在我的存储库中有长期存在的分支,可能需要大量滚动才能找到提交所在的分支。

(与 How can I show the name of branches in `git log`? 类似的问题)

最佳答案

我用这个:

git log --pretty=format:\"%h %ad [%an] %s%d\" --graph --date=short
--all --date-order

我将别名添加到我的全局 .gitconfig

[alias]
hist = log --pretty=format:\"%h %ad [%an] %s%d\" --graph --date=short --all --date-order

并且可以调用简单的git hist

它制作了非常易于阅读的修订树,在一行中包含简短的提交哈希、作者、日期、分支、HEAD 等

关于git - 如何在 `git log` 中的每个提交中显示分支名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10593229/

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