Restrict clone depth for all pull/fetch to 20k for Git

30 views Asked by At

I must restrict the depth at which our source code is checked out for many reasons.

I'm aware of the ability to pull in git with a specified depth using git pull --depth 3, but I'm looking for a way to default the depth of checkout to 20k commits or some arbitrary number of commits.

It would be even better if there was a way to restrict the pulling of commits older than a specific date.

1

There are 1 answers

0
iamthedrake On

There is no support within Git to restrict or protect older commits than a specific point (be it date or specific sha).

As a fellow commenter pointed out, you could create one git repository containing the history of the project up until some fixed point (which won't change) then create a second repository without the history and let everyone use that repository (src: dan1st-is-crying)