0

My repository is big after years, so I would like to make it smaller, but i don't know what is the best approach. I would like to delete the older half of my repository, but it must not affect the history.

Something which would merge the half of the commits to one only if it would compress the repository?

pcampana
  • 2,413
  • 2
  • 21
  • 39
pradub
  • 1
  • I'm not sure I understand your goal here, you want to delete the older half of your repository, without affecting history? That is not possible, even compressing the oldest half of the commits to one big commit would affect history, you would no longer have the per-commit changes on that half. And I'm not talking about the "rewrite history" type of affecting history, I'm saying that you can no longer go back and see when and why something was done, in that compressed half. Can you explain what you mean here? – Lasse V. Karlsen Apr 15 '20 at 08:24
  • yeah, my boss is telling me that the repository is after 6 years too big. 2GB. so he asked me to reduce it. you got the point? – pradub Apr 15 '20 at 08:42
  • Gino: nope. the only usefull comment i found there was about using git gc . but someone reacted by comment with no answer "But, when I delete the repo then clone it again, the size is still large. How do you handle that?" – pradub Apr 15 '20 at 08:47
  • 1
    Run `git gc` on the server. – fredrik Apr 15 '20 at 08:58
  • 1
    The point is that this is a self-contradiction: "I would like to delete the older half of my repository, but it must not affect the history". That is impossible, so which do you want? – matt Apr 16 '20 at 02:26
  • You can do shallow clones to avoid fetching the whole thing, that'll get you smaller clones and leave the main repo intact. – jthill Apr 16 '20 at 03:49

0 Answers0