前提必須安裝git 軟件,保證右鍵有gitbash here 這個選項
1.進入本地代碼目錄
就是找到 帶有.git文件夾的目錄 通常情況下這個文件夾是被隱藏的需要設置開啟
開啟方式 以win10系統為例
windows + E 快捷鍵打開文件管理器 點擊查看 勾選隱藏的文件
2.點擊右鍵選擇 gitbash here 進入了git命令行界面
(1)統計自己在倉庫的總代碼提交量
粘貼以下代碼 並回車
git log --since="2020-11-11" --before="2022-12-13" --author="$(git config --get user.name)" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }'
(1)統計所有人在此倉庫的總代碼提交量
粘貼一下代碼 並回車
git log --format='%aN' | sort -u | while read name; do echo -en "$name\t"; git log --author="$name" --pretty=tformat: --since ==2007–03-01 --until=2022-06-30 --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
add remove total 這就表示代碼統計了 應該不用解釋了吧
3.統計提交次數
git log --author=倉庫用戶名 --since="2020-01-01" --until="2020-12-31" --no-merges | grep -e 'commit [a-zA-Z0-9]*' | wc -l