List remote Git branches and the last commit's author and author date for each branch. Sort by most recent commit's author date.

Listing each branch and its last revision's date in Git

 

List remote Git branches and the last commit's author and author date for each branch. Sort by most recent commit's author date. 

# Credit http://stackoverflow.com/a/2514279

for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ai %ar by %an" $branch | head -n 1` \\t$branch; done | sort -r

 

或者在.gitconfig中配置

[alias]
    branchauthors = "! for branch in `git branch -r | grep -v HEAD`;do echo `git show --format=\"%ai %ar by %an\" $branch | head -n 1` \t$branch; done | sort -r"

 

显示commit的前9个字符

    branchauthors = "! for branch in `git branch -r | grep -v HEAD`; do sha=$(git rev-parse --short=9 $branch); commit_info=$(git show --format=\"%ai %ar by %an\" $branch | head -n 1); echo \"$commit_info $sha\t$branch\"; done | sort -r"

 

posted @ 2024-03-05 10:22  ChuckLu  阅读(2)  评论(0编辑  收藏  举报