I regularly want to get a few files from a large repository that has a huge number of tiny files and very frequent changes to parts of them.
Ideally I'd just fetch a shallow clone with -n
and then check out just the directory containing the files I need. Curiously I just had a path that wasn't known (referenced in the history) after a git clone -n --depth=1
while it is evidently present on disc after a git clone --depth=1
(so without the -n
option).
Looks like -depth
is interpreted differently with or without that option present?
If I'm not doing anything else wrong, is there a way to deepen a shallow history until the latest commit to a given path - without first determining which commit that is (e.g. via the web interface)?
EDIT: here's what I've been doing:
> git clone -v --depth=1 -n github:macports/macports-ports mptree-git # github: expands to git@github.com:
Cloning into 'mptree-git'...
remote: Enumerating objects: 50097, done.
remote: Counting objects: 100% (50097/50097), done.
remote: Compressing objects: 100% (29444/29444), done.
remote: Total 50097 (delta 7644), reused 38087 (delta 6403), pack-reused 0
Receiving objects: 100% (50097/50097), 31.88 MiB | 5.31 MiB/s, done.
Resolving deltas: 100% (7644/7644), done.
> git -C mptree-git/ checkout security/KeePassXC
error: pathspec 'security/KeePassXC' did not match any file(s) known to git
Exit 1