Categories
Linux Mastering Development

Switch all my git repositories to depth 20, to save space?

I know that git clone --depth=20 <repo> is oftentimes much much smaller than git clone. Official docs for --depth.

Looks like I’ve gone a bit crazy with my repos folder, here’s the fd piped to wc and du, with output:

$ 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 .

Is there some command I can use to remove all the history and prune all the orphans, older than 20?

Leave a Reply

Your email address will not be published. Required fields are marked *