简体   繁体   English

在本地派生一个Git仓库(复制Git仓库?)

[英]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. 我的文件系统上有一个本地Git存储库。 There is way too much history in there. 那里的历史太多了。 I just need to clone it with depth=5 or so, etc. 我只需要将其克隆为depth = 5左右,等等。

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; 警告:--depth在本地克隆中被忽略; use file:// instead 使用file://代替

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 这是用于此的文档: https : //mirrors.edge.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS

Thanks for edit, @Olegzandr 感谢您的编辑,@ Olegzandr

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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