Git:如何获取用户列表以及他们编写了多少行代码 [英] Git: How to get a list of users and how many lines of code they've written

查看:322
本文介绍了Git:如何获取用户列表以及他们编写了多少行代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我前段时间写了/偷了一个脚本,找出了Git仓库中特定文件的当前所有者。



I wrote/stole a script some time ago to find out the current "owner" of a particular file that's in a Git repo.

#!/bin/bash
git blame --line-porcelain "$@" | sed -n 's/^author //p' | sort | uniq -c | sort -rn





它显示git blame的结果,并按每个用户修改的行数对其进行排序。



结果如下所示:





It shows the results from git blame and sorts it by how many lines each user has modified.

The result looks something like this:

125 Joe
 16 Fred
 16 Alice
  7 Jane
  4 Bob







引用:

我的问题是,如何修改此脚本以递归整个仓库而不是单个文件?

My question is, how can I modify this script to recurse over an entire repo as opposed to a single file?

推荐答案

@| sed -n's / ^ author // p'| sort | uniq -c | sort -rn
@" | sed -n 's/^author //p' | sort | uniq -c | sort -rn





它显示git blame的结果,并根据每个用户修改的行数进行排序。



结果如下所示:< br $>




It shows the results from git blame and sorts it by how many lines each user has modified.

The result looks something like this:

125 Joe
 16 Fred
 16 Alice
  7 Jane
  4 Bob







Quote:

我的问题是,我怎么能修改这个用于递归整个仓库而不是单个文件的脚本?

My question is, how can I modify this script to recurse over an entire repo as opposed to a single file?


这篇关于Git:如何获取用户列表以及他们编写了多少行代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆