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"

 

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(4)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2022-03-05 进制转换
2021-03-05 jQuery ajax() success, error VS .done(), .fail()
2021-03-05 because they do not possess a common algorithm
2021-03-05 微增长时代
2021-03-05 excel在一个单元格 引用另外一个单元格
2019-03-05 IIS Logs
2019-03-05 21. Merge Two Sorted Lists
点击右上角即可分享
微信分享提示