简体   繁体   English

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

[英]How can I show the name of branches on every commit in `git log`

In Gitk, showing a commit gives output like this: 在Gitk中,显示提交会给出如下输出:

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

Is there a way to get this kind of output in git log ? 有没有办法在git log获得这种输出? Using git log --graph gives similar information, but in my repository with long-lived branches, it can take a lot of scrolling to find which branch a commit was on. 使用git log --graph提供类似的信息,但是在我的存储库中使用长期分支,可能需要大量滚动才能找到提交所在的分支。

(A similar question to How can I show the name of branches in `git log`? ) (类似的问题如何在`git log`中显示分支的名称?

I use this: 我用这个:

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

I added alias to my global .gitconfig 我在全局.gitconfig添加了别名

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

and can call simple git hist 并且可以调用简单的git hist

It makes very pretty-to-read revisions tree with short commits hash, author, date, branches, HEADs etc on one line 它在一行中提供非常漂亮的读取修订树,包括短提交哈希,作者,日期,分支,HEAD等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM