shallow clone
git clone --depth=1 https://github.com/cloudwu/skynet.git
git log --oneline | wc -l
1
du -hs .git
792K .git
fully clone, and reduce the depth
git clone https://github.com/cloudwu/skynet.git
git log --oneline | wc -l
2137 # 2137 entries!
du -hs .git
4.9M .git
git fetch --depth 1 # this will fetch the newest commit from origin (if there are any) and then cut off the local history to depth of 1 (if it was longer)
git reflog expire --expire=all --all # clear the reflog
git tag -l | xargs git tag -d # remove all tags
git branch -d branchname # remove a branch
git stash drop # drop the stashes
git gc --prune=all # remove the dangling commits
git log --oneline | wc -l
1
du -hs .git
792K .git
to undo a --depth and get the entire history again
git fetch --unshallow
Reduce Depth of an Existing Git Repo ⚓️
How to reduce the depth of an existing git clone?
EOF
标签:git,--,clone,Reduce,Existing,depth,Git,oneline From: https://www.cnblogs.com/hangj/p/17044017.html