Since Git is cumulative, how to deal with this for a long time when the repo becomes 5 GB?

For Git, since the whole story is there, I wonder if I save the repo for storing all the code I wrote for 5 years or 10 years, with the whole revision history, then the repo becomes 5GB.

And if the machine does not have a repo, and I just want to try a piece of code or a small Rails project, I have to clone all 5 GB, and that won't be too practical.

Say, if out of 5 GB only 200 MB are current files, and all the rest is history, then at least if you use SVN, then each machine will have 200 MB, not 5 GB. Git may be very suitable for every standalone small or medium project, but what if this is the “long term of my repo”, then how to use Git for it?

+4
source share
3 answers

You are right, and the Git Wiki agrees with you . At the same time, if you do not need to push / pull changes from this hypothetical Git repository, you can make a “small” clone to pull the commit without it:

git clone --depth X 

Where X is how far back in history you want to go. 1 you get the most recent commit, 2 pulls the most recent and previous, and so on and so forth.

+5
source

Use multiple Git repositories. One server can process any number of repositories.

If you want to get into the repository, you can create a new branch, rewrite its history (merging several commits into one) and delete the first branch.

+6
source

You would not use Git for this because it is not that for Git .;)

Given how quick and easy it is to create a (possibly local) repo, there are not many reasons not to have them for each project and several reasons to do this (the ability to track them separately, topic, etc.).

Regarding the data on the 5 GB repositories, you can look at the steps here and this question regarding the limits of Git.

+1
source

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


All Articles