How to reduce the size of a .git folder with a huge commit history?

We work in a group and send large amounts of data daily, which is why the .git folder becomes very heavy in size. And when you execute the pull command on our system, it takes a lot of time due to the large size of the .git folder. How can we clean or reduce the size of this git repo?

+4
source share
2 answers

You need to determine if there is something inherently big in your repository - for example, too many large binaries - or if garbage collection fixes it.

Collect garbage, see how big your repo is.

, Atlassian, @sauerburger, Google, , .

( .)

0

.git, , , .

, , !

(fooobar.com/questions/814546/...):

, , branchname. , , , reset , - ( , , ):

git tag temp

git checkout 10004
git checkout --orphan new_root
git commit -m "set new root 10004"

git rebase --onto new_root 10004 branchname

git diff temp   # verification that it worked with no changes
git tag -d temp
git branch -D new_root

, ;

git prune
git gc

.

, , gc 'd, ; rebase , .

0

Source: https://habr.com/ru/post/1684389/


All Articles