Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git cannot create shallow-since locally

I am trying to create a --shallow-since working clone from a local bare clone but it keeps pulling everything. --depth=N works fine.

I'm thinking the issue is I'm using the wrong format? I've tried searching but no where does it explicitly say what format < date > is supposed to be for --shallow-since=< date >.

like image 782
arthur doe Avatar asked May 09 '17 20:05

arthur doe


People also ask

Is shallow clone faster?

Shallow clones are the fastest way to get a copy of the working directory at the tip commit. If you need the commit history for your build, then a treeless partial clone might work better for you than a full clone.

What is a shallow repository git?

A shallow repository has an incomplete history some of whose commits have parents cauterized away (in other words, Git is told to pretend that these commits do not have the parents, even though they are recorded in the commit object).

How do I clone a git repo faster?

The first solution to a fast clone and saving developer's and system's time and disk space is to copy only recent revisions. Git's shallow clone option allows you to pull down only the latest n commits of the repo's history. Imagine you accumulated ten or more years of project history in your repository.


2 Answers

I used:

--shallow-since="3 years"

and it worked fine.

like image 72
Tom Hale Avatar answered Oct 02 '22 14:10

Tom Hale


Using UNIX timestamp:

git fetch upstream master --shallow-since=1589324214

on git version 2.26.2.windows.1 and in GitHub actions CI also works just fine.

like image 37
Maxim Mazurok Avatar answered Oct 02 '22 16:10

Maxim Mazurok