Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list all the log for current project in git?

Tags:

git

logging

I use git log, but I find it can only list logs under current branches, but I want to list all the loges for all the branches and sort by modified date, is that possible ? How to do that ?Thanks in advance !

like image 583
MemoryLeak Avatar asked Sep 11 '25 06:09

MemoryLeak


1 Answers

You can check this question to see if this begin to address your log level:

git log --graph --abbrev-commit --pretty=decorate --branches

it should list all branches including remotes ones (if fetched)

--branches[=pattern]

Pretend as if all the refs in refs/heads are listed on the command line as <commit>.
If pattern is given, limit branches to ones matching given shell glob.
If pattern lacks ?, , or [, / at the end is implied.


You can try this commandline-fu, with git branch or git branch -a:
(git branch -a is certainly what you need of you want to see the same branches than gitk)

for k in `git branch -a|perl -pe s/^..//`;do echo -e `git show --pretty=format:"%Cgreen%ci %Cblue%cr%Creset%cn: %s" $k|head -n 1`\\t$k;done|sort -r

or:

for k in `git branch -a|sed s/^..//`;do echo -e `git log -1 --pretty=format:"%Cgreen%ci %Cblue%cr%Creset%cn: %s" "$k"`\\t"$k";done|sort

(you can complete the format to show any data -- author, commit message, ... -- you need)

Show git branches by date - useful for showing active branches Print out list of all branches with last commit date to the branch, including relative time since commit and color coding.


Note: As Jakub Narębski aptly comments:

Don't use git branch output for scripting!!! Use git for-each-ref or git show-ref plumbing (low-level commands meant for scripting)

git branch is a porcelain command precisely because it meant for user, and not for scripting.

As Eric Raymond puts it, It fits the well-established git design philosophy of separating content manipulation (plumbing) from presentation (porcelain).

like image 116
VonC Avatar answered Sep 13 '25 01:09

VonC