S
S
strelkovandreyv2019-08-22 19:36:05
git
strelkovandreyv, 2019-08-22 19:36:05

How to delete commits older than 1 year in GitLab?

Good afternoon, due to certain specifics of the project, it currently has 60,000 commits and, accordingly, their number is growing dozens of times a day.
Please tell me how can I delete commits that are older than 1 year, for example?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
Georg Gaal, 2019-08-23
@gecube

This is a bad idea, because each subsequent commit depends on the previous one. And all commits will change sha after the collapse.
Colleagues have already given information above on how to use the rebase command for this purpose.
This means that after the collapse, all users of the repository will need to download it completely and delete the old copies.
By itself, the number of commits is usually not a limit or limitation when working with a large repository. There is a size limit in Gitlab itself, but it's usually enough for a project of any reasonable size. And if you have a mono-repository and it has gone beyond the limits, then either you move to your gitlab instance, or it's time to divide the project into modules, each in a separate repository.
I also want to add that git clone has a wonderful depth parameter, which allows you to limit the depth of cloning a repository if you want to save traffic and do not need history from the very beginning.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question