简体   繁体   中英

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

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`? )

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

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

and can call simple git hist

It makes very pretty-to-read revisions tree with short commits hash, author, date, branches, HEADs etc on one line

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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