Skip to content

Commit

Permalink
doc: update git.md (jaywcjlove#216)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwqaaq authored Dec 7, 2022
1 parent 4038382 commit 7348140
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/git.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
----

Expand Down

0 comments on commit 7348140

Please sign in to comment.