英文:
How to get how many lines you wrote in Github project and how many lines you wrote were deleted
问题
我的高级同事给了我一个任务,要找出我在GitHub项目中写了多少行代码,以及其中有多少行被删除了。是否有内置的方法可以实现这一目标?请记住,我不是这个项目上唯一的开发者。我的高级同事想要证明我的代码不合格。
英文:
My senior has given me a task to find out the number of lines I wrote in a GitHub project and how many of those lines were deleted. Are there any built-in methods available to achieve this? Keep in mind that I am not the only developer on the project. My senior wants proof that my code is not up to par.
答案1
得分: 1
你需要进入Github项目页面,点击顶部导航栏中的"Insights",然后在左侧点击"Contributors"。加载完成后,你会看到每个贡献者的添加(绿色)和删除(红色)情况,这表示每位贡献者添加和删除的行数。
英文:
You need to go on the page of the Github project click, on the top bar, go to the insights and after on the contributors on the left after. After a loading you gonna see the additions (green) and deletions (red) for each person, which is the number of line add and delete by contributors.
答案2
得分: 0
我找到了一个解决方案,但可能仍然存在一种只需一个命令的解决方案。
git log --shortstat --since="1 year ago" --until="now" \
| grep "files changed\|Author\|Merge:" \
| awk '{
if ($1 == "Author:") {
currentUser = $2;
}
if ($2 == "files") {
files[currentUser]+=$1;
inserted[currentUser]+=$4;
deleted[currentUser]+=$6;
}
} END {
for (i in files) {
print i ": files changed:", files[i], "lines inserted:", inserted[i], "lines deleted:", deleted[i];
}
}'
英文:
I found a solution, but may be still there are a solution in only one command.
git log --shortstat --since="1 year ago" --until="now" \
| grep "files changed\|Author\|Merge:" \
| awk '{ \
if ($1 == "Author:") {\
currentUser = $2;\
}\
if ($2 == "files") {\
files[currentUser]+=$1;\
inserted[currentUser]+=$4;\
deleted[currentUser]+=$6;\
}\
} END {\
for (i in files) {\
print i ":", "files changed:", files[i], "lines inserted:", inserted[i], "lines deleted:", deleted[i];\
}\
}'
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论