Skip to content
Latchkey

git clone --shallow-since: Time-Bounded History

git clone --shallow-since=<date> fetches only commits newer than that date, useful when you need recent history of unknown depth rather than a fixed --depth count.

A fixed --depth is a guess; --shallow-since bounds history by time instead, so you get every commit in the last week or since a release tag without overshooting. It pairs with --shallow-exclude to stop at a ref.

What it does

git clone --shallow-since=<date> creates a shallow clone containing commits committed after <date>. --shallow-exclude=<ref> instead truncates history at a given tag or ref. Both are alternatives to --depth that express "how much history" in terms the build actually cares about.

Common usage

Terminal
git clone --shallow-since="2 weeks ago" https://github.com/org/repo
git clone --shallow-since="2026-06-01" https://github.com/org/repo
# stop history at the previous release tag
git clone --shallow-exclude=v1.4.0 https://github.com/org/repo
# deepen an existing shallow clone by date
git fetch --shallow-since="1 month ago"

Options

FlagWhat it does
--shallow-since=<date>Include only commits after this date
--shallow-exclude=<ref>Truncate history at this ref/tag
--depth <n>Alternative: fixed number of commits
--unshallowConvert a shallow clone to a full one
--no-single-branchFetch all branches within the shallow window

In CI

Use --shallow-since when a step (changelog, diff against last release) needs "since X" history but not the whole repo. The server must support the protocol; older or proxied Git servers may refuse and you fall back to --depth. A clone too shallow for git describe or git merge-base will error later; deepen or --unshallow if so.

Common errors in CI

"fatal: the remote end hung up unexpectedly" or "Server does not support --shallow-since" means the host or protocol version cannot honor it; use --depth. "fatal: no commits selected for shallow requests" means the date excluded the branch tip entirely (date in the future or wrong format).

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →