doc: update git.md (#216)
This commit is contained in:
parent
403838287e
commit
7348140ae1
35
docs/git.md
35
docs/git.md
@ -960,6 +960,41 @@ Host github.com
|
||||
```
|
||||
<!--rehype:className=wrap-text-->
|
||||
|
||||
git 代码统计
|
||||
---
|
||||
|
||||
### 查看 git 上的个人代码量
|
||||
|
||||
- `username` 需要改成自己的
|
||||
|
||||
```bash
|
||||
git log --author="username" --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 }' -
|
||||
```
|
||||
|
||||
### 统计每个人增删行数
|
||||
|
||||
```bash
|
||||
git log --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
|
||||
```
|
||||
|
||||
### 查看仓库提交者排名
|
||||
|
||||
这里是排名前十,也可以更改排名
|
||||
|
||||
```bash
|
||||
git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 10
|
||||
```
|
||||
|
||||
### 提交数统计
|
||||
|
||||
```bash
|
||||
git log --oneline | wc -l
|
||||
```
|
||||
|
||||
Conventional Commmits
|
||||
----
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user