统计一段时间内的提交总数

git log --since="2019-01-01 00:00:01" --until="2019-03-31 00:00:01" --oneline | wc -l  

统计添加或者修改的代码行数

find . -name "*.cpp" -or -name "*.bat" -or -name "*.txt" -or -name "*.java" -or -name "*.h" -or -name "*.cxx" -or -name "*.c" | xargs grep -v "^$"|wc -l

统计一段时间内修改和增加代码行数

git log --since="2019-01-01 00:00:01" --until="2019-03-31 00:00:01" --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; loc += $1 - $2 } END { printf "added lines: %s, removed lines: %s, total lines: %s\n", add, subs, loc }' -; done

统计一段时间内的提交记录详情

git log --numstat --since="2019-01-01 00:00:01" --until="2019-03-31 00:00:01"

代码统计工具cloc

其特点是输出各种语言类型的代码行数和空行数

-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Perl                          2052         110356         130018         292281
C                              135          18718          22862         140483
C/C++ Header                   147           7650          12093          44042
Bourne Shell                   116           3402           5789          36882
Lisp                             1            684           2242           7515
make                             7            498            473           2044
C++                             10            312            277           2000
XML                             26            231              0           1972
yacc                             2            128             97           1549
YAML                             2              2              0            489
DOS Batch                       11             85             50            322
HTML                             1             19              2             98
-------------------------------------------------------------------------------
SUM:                          2510         142085         173903         529677
-------------------------------------------------------------------------------

临时忽略提交某个文件

1. 打开全局配置 .git/config文件

2. 增加 

[alias]

ignore = update-index --assume-unchanged

unignore = update-index --no-assume-unchanged

ignored = !git ls-files -v | grep "^[[:lower:]]"

3. 运行 git ignore filename

这样,再次提交时这个文件的修改就不会被提交。
如果需要再次提交这个文件,运行 

git unignore filename