我知道git clone --depth=20 常常比git clone小得多。官方文件--depth。
看起来我的repos文件夹有点疯狂了,下面是带有输出的fd C3:
$ declare -r ALL_GIT="$(fd -HIFt d '.git')"
$ echo "$ALL_GIT" | wc -l
1528
$ echo "$ALL_GIT" | du -hs
du: cannot access './freebsd/contrib/bmake/PSD.doc/tutorial.ms': Permission denied
du: cannot access './freebsd/contrib/bmake/PSD.doc/Makefile': Permission denied
du: cannot access './statsmodels/statsmodels/statsmodels/datasets/macrodata/src/macrodata.xls/macrodata.xls': Permission denied
44G .有什么命令可以用来删除所有的历史记录和修剪所有的孤儿,比20大吗?
发布于 2020-06-30 04:35:19
根据我在这里的答案--基于这里的其他答案--https://stackoverflow.com/a/62650346,正如@muru所提到的,下面是有效的方法:
git pull --depth 20
git tag -d $(git tag -l)
git reflog expire --expire=all --all
git gc --prune=all要通过在整个磁盘上运行此命令来节省空间吗?-然后运行以下fd命令:
fd -HIFt d '.git' -x bash -c 'pushd "$0" && ( git pull --depth 20; git tag -d $(git tag -l); git reflog expire --expire=all --all; git gc --prune=all ) && popd' {//}或者只是普通的find:
find -type d -name '.git' -exec bash -c 'pushd "${0%/*}" && ( git pull --depth 20; git tag -d $(git tag -l); git reflog expire --expire=all --all; git gc --prune=all ) && popd' {} \;-这对我意味着什么?-好吧,前面提到的44G
https://unix.stackexchange.com/questions/595650
复制相似问题