How can I show the branch name on each commit in `git log`

In Gitk, showing a commit is output as follows:

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

Is there any way to get this kind of output in git log? Using git log --graphgives similar information, but in my repository with long-lived branches, it might take a lot of scrolling to find which branch the commit was included in.

(similar question How do I show the branch name in `git log`? )

+3
source share
1 answer

I use this:

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

I added an alias to my global .gitconfig

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

and can cause a simple git hist

It makes a very readable change tree with short commits of hashing, author, date, branches, HEAD, etc. on one line

+5
source

All Articles