Git常用统计命令

  1. 按照增删代码行数,输出百分比,对贡献者进行排名
git log --all --no-merges --numstat --pretty=format:"%an" | awk '
/^[^0-9-]/ {user=$0}
/^[0-9]/ {add[user]+=$1; del[user]+=$2; total+=$1+$2}
END {
for (u in add)
printf "%s: %d/%d = %.2f%%\n", u, add[u]+del[u], total, (add[u]+del[u])*100/total
}' | sort -t= -k2 -nr
Station Chenqiao: 634940/1677098 = 37.86%
liuc: 589876/1677098 = 35.17%
tongyuhu: 262416/1677098 = 15.65%
zhenwei: 57935/1677098 = 3.45%
Shuo Dai: 56632/1677098 = 3.38%
niuhao: 49964/1677098 = 2.98%
SunYupeng: 17014/1677098 = 1.01%
daisy: 4615/1677098 = 0.28%
陈桥驿站: 2879/1677098 = 0.17%
ohhhhDaisy: 718/1677098 = 0.04%
zhenwei688: 106/1677098 = 0.01% <--
Administrator: 3/1677098 = 0.00%
  1. 项目第一次提交的日期
git log --reverse --format="%ad" --date=short | head -n 1
2020-11-25

Git rebase 修改已经Push的提交的信息

如果想修改已经推送到远程的 Git 提交信息,可以使用 git rebase 和 git commit –amend 来更改提交历史。修改已经推送的提交信息是有风险的,特别是如果其他人已经拉取了你的提交历史。修改历史后,可能会导致他们的工作分叉,因此在多人协作时要小心使用。

Snipaste 2024 12 03 23 16 19

阅读更多

Git检测不到新建的index.tsx

之前总结过,没解决根本问题,还是没有找到本地的什么配置,导致了 index.tsx 被忽略 …

最近电脑莫名其妙抽风了,新建什么文件都行,唯独index.tsx,死活检测不到文件变化,每次都要手动执行:

git add /src/.../index.tsx --force

我 TM 心态都要爆炸了 …

Snipaste 2024 11 10 10 26 28

阅读更多

Error installing lottie-ios

iOS安装lottie报错:

[!] Error installing lottie-ios
[!] /usr/local/bin/git clone https://github.com/airbnb/lottie-ios.git /var/folders/s4/d4hj6wbj1_j3w4ynthv1klf80000gn/T/d20240201-9298-1c37cjq --template= --single-branch --depth 1 --branch 4.4.0

正克隆到 '/var/folders/s4/d4hj6wbj1_j3w4ynthv1klf80000gn/T/d20240201-9298-1c37cjq'...
error: RPC 失败。curl 56 Recv failure: Connection reset by peer
error: 预期仍然需要 5466 个字节的正文
fetch-pack: unexpected disconnect while reading sideband packet
fatal: 过早的文件结束符(EOF)
fatal: index-pack 失败
阅读更多