简体   繁体   English

Git:将仓库复制到新目录以继续工作

[英]Git: Copy Repo To New Directory To Continue Working

I've been working in directory v3 (ie master). 我一直在目录v3(即master)中工作。

I am now in a new directory, v4. 我现在位于新目录v4中。

While in v3, I created the branch v4. 在v3中,我创建了分支v4。

How do I bring in the .git file from directory v3 into directory v4 and continue posting to the new branch? 如何将.git文件从目录v3引入目录v4,并继续发布到新分支?

I initially thought of cloning v3 into v4 but that clones all the source files as well. 我最初想到将v3克隆到v4,但这也克隆了所有源文件。 I don't need all that, just the .git file if possible. 我不需要所有这些,只要可能就只要.git文件。

You can easily make a new repo in v4 using git init. 您可以使用git init在v4中轻松创建新的仓库。 It's possible to merge these repos later.. 以后可以合并这些存储库。

Or if your v4 folder is already a git repo, do this from v3 folder: 或者,如果您的v4文件夹已经是git repo,请通过v3文件夹执行此操作:

git checkout v4
git pull ../v4 master # pulling branch master from repo in v4 directory

(or please refer to the docs of git pull if I'm wrong) (或者如果我错了,请参考git pull的文档)

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

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