9

Can I use a relative date in git clone's --shallow-since=<date> (e.g. sth like one-year-ago)?

Command substitution (like $(one-year-ago-command) in bash and PowerShell or `one-year-ago-command` in bash) is no real alternative as I'm using cmd and for /f is a pain in the a**.

sopupe
  • 183
  • 1
  • 8

1 Answers1

1

Yes, you can do that. It works with the same <date> formats you can pass to e.g. git log --since=<date>.

For example:

git clone --shallow-since="1 week ago" <url>

This works with Git version 2.20.1.

See also:

mkrieger1
  • 19,194
  • 5
  • 54
  • 65