How to list all the log for current project in git

2019-02-19 03:41发布

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 !

标签: git logging
2条回答
淡お忘
2楼-- · 2019-02-19 04:33

git log --all

查看更多
放荡不羁爱自由
3楼-- · 2019-02-19 04:44

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

查看更多
登录 后发表回答