简体   繁体   中英

fork a Git repo locally (copy the Git repo?)

I am having a surprisingly difficult time finding an answer to this online.

I have a local Git repo on my filesystem. There is way too much history in there. I just need to clone it with depth=5 or so, etc.

I was thinking of copying the repo locally and then pruning it (getting rid of some old stuff).

Ideally I could copy the original repo with something like:

git clone --depth=5 /local/path/to/repo

but I can't find info on the exact command to run.

I tried that last command and I got this warning:

warning: --depth is ignored in local clones; use file:// instead

As the warning suggests:

git clone --depth=5 file:///local/path/to/repo

Here are the docs for this: https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS

Thanks for edit, @Olegzandr

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM