zoukankan      html  css  js  c++  java
  • GIT统计代码行数

    1、使用git log

    cd /data/gitlab/gitlab/repositories/dataanalysis/
    cd doc-center.git
    git log --since ==2019-01-01 --until=2019-01-01 | wc -l
    
    git log --author=yourname --since="2019-01-01" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l
    git log --since="2019-01-01" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l
    
    git log | grep "^Author: " | awk '{print $2}' | sort | uniq -c | sort -k1,1nr
    
    
    git log --author="用户名" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s
    ", add, subs, loc }' -

    2、使用gitstats

    gitstats /data/gitlab/gitlab/repositories/dataanalysis/doc-center.git /data/git_stat_html/doc-center

    这个生成html统计页面,很方便看。还有个类似的产品是git_stats

    提交次数git shortlog --numbered --summary
    查看所有的commit数git log --oneline | wc -l
    提交删除行数git log --author="$(git config --get user.name)" --pretty=tformat: --numstat | awk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s ",add,subs,loc }'
    使用cloc统计代码行数给力:

  • 相关阅读:
    线段树(updata+query)
    铁轨(栈)
    困难的串(搜索)
    素数环(简单搜索)
    编码
    opencv + numpy for python
    PIL参考手册
    八数码问题
    三维地图(BFS)
    梯田(dfs)
  • 原文地址:https://www.cnblogs.com/linn/p/11855338.html
Copyright © 2011-2022 走看看