“git clone”的最佳做法是什么?到一个现有的文件夹? [英] What's the best practice to "git clone" into an existing folder?
问题描述
我有该项目的工作副本,没有任何源代码管理元数据。现在,我希望将git-clone等同于此文件夹,并保留本地更改。
git-clone不允许我克隆到现有的文件夹。这里最好的做法是什么?
这可以通过克隆到一个新目录,然后移动<$ c $如果您的现有目录名为code。
git clone https://myrepo.com/git.git temp
mv temp / .git code / .git
rm -rf temp
这也可以在克隆命令执行时不做结账;更多信息可在此处找到。
I have a working copy of the project, without any source control meta data. Now, I'd like to do the equivalent of git-clone into this folder, and keep my local changes.
git-clone doesn't allow me to clone into an existing folder. What is the best practice here?
This can be done by cloning to a new directory, then moving the .git
directory into your existing directory.
If your existing directory is named "code".
git clone https://myrepo.com/git.git temp
mv temp/.git code/.git
rm -rf temp
This can also be done without doing a checkout during the clone command; more information can be found here.
这篇关于“git clone”的最佳做法是什么?到一个现有的文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!