From a2a6011b31b8d950c4317d3f246d9b71bb2ccba8 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Tue, 29 Aug 2023 09:34:28 +0800 Subject: [PATCH] doc: update docs/git.md --- docs/git.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/git.md b/docs/git.md index d729325..4b2b274 100644 --- a/docs/git.md +++ b/docs/git.md @@ -855,7 +855,7 @@ $ git checkout -- 删除本地存在远程不存在的分支 ```shell -git remote prune origin +$ git remote prune origin ``` ### 获取最近一次提交的 Hash @@ -1157,11 +1157,29 @@ $ git whatchanged --since='2 weeks ago' ### 在 commit log 中查找相关内容 ```bash -git log --all --grep='' +$ git log --all --grep='' ``` 通过 grep 查找,given-text: 所需要查找的字段 +### Git 仓库的大小 + +```bash +$ git ls-files | xargs -r du -hs +``` + +### Git 仓库的总大小 + +```bash +$ git count-objects -vH +``` + +### 查询历史体积大的 10 个文件 + +```bash +$ git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | awk '/^blob/ {print substr($0,6)}' | sort --numeric-sort --key=2 --reverse | head -n 10 | cut -c 13- +``` + Conventional Commmits ----