3

In Gitk, showing a commit gives output like this:

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? 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.

(A similar question to How can I show the name of branches in `git log`?)

4

1 回答 1

5

我用这个:

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 等

于 2012-05-18T13:17:13.017 回答