From 4020036f93a345c59fdfb8a4f36303770edc57d1 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Tue, 15 Aug 2023 00:11:22 +0800 Subject: [PATCH] doc: update docs/git.md --- docs/git.md | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/git.md b/docs/git.md index 451cf0d..9655e73 100644 --- a/docs/git.md +++ b/docs/git.md @@ -389,21 +389,8 @@ $ git mv [existing-path] [new-path] $ git log --stat -M ``` -### git 配置 ssh 代理 - - -```bash -$ cat ~/.ssh/config -Host gitlab.com -# 直接使用 sh**socks 提供的 socks5 代理端口 -ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p - -Host github.com -ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p -``` - - ### .gitattributes + ```ini # 设置默认行为,以防人们没有设置 core.autocrlf @@ -435,6 +422,19 @@ special-vendored-path/* linguist-vendored *.rb linguist-language=Java ``` +### git 配置 ssh 代理 + +```bash +$ cat ~/.ssh/config +Host gitlab.com +# 直接使用 sh**socks 提供的 socks5 代理端口 +ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p + +Host github.com +ProxyCommand nc -X 5 -x 127.0.0.1:1080 %h %p +``` + + Git 技巧 ------ @@ -964,6 +964,7 @@ git 代码统计 --- ### 查看 git 上的个人代码量 + - `username` 需要改成自己的 @@ -971,8 +972,10 @@ git 代码统计 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 |\ @@ -980,6 +983,7 @@ git log --format='%aN' | sort -u |\ 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 ``` + ### 查看仓库提交者排名 @@ -988,6 +992,7 @@ git log --format='%aN' | sort -u |\ ```bash git log --pretty='%aN' | sort | uniq -c | sort -k1 -n -r | head -n 10 ``` + ### 提交数统计