实用的 Git 命令

列出项目下所有作者以及提交次数

git shortlog -sne --all

列出过去一年项目下哪些文件被提交次数最多

git rev-list --after='one year ago' --objects --all | git cat-file --batch-check='%(objecttype) %(rest)' | sed -n 's/^blob //p' | sort -k1 | uniq -cf0 | awk '$1 > 1' | sort -rn

 找到两个分支的共同祖先,返回 hash 值

git merge-base targetBranch sourceBranch

 

posted @ 2021-06-01 15:09  savokiss  阅读(34)  评论(0编辑  收藏  举报