开发者

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

I use git log,开发者_C百科 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 !


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


git log --all

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜