我的目录A的文件与目录B匹配。目录A可能还有其他需要的文件。目录B是git仓库。
我想将目录B克隆到目录A,但是git-clone不允许我这样做,因为该目录是非空的。
我希望它只是克隆.git,既然所有文件都匹配,我可以从那里去吗?
我无法克隆到空目录,因为目录A中的文件不在目录B中,因此我想保留它们。
复制.git是不可行的,因为我想使用refs进行推/拉操作,并且我不想手动设置它们。
有什么办法吗?
更新:我认为这可行,任何人都可以看到任何问题吗?->
cd a
git clone --no-hardlinks --no-checkout ../b a.tmp
mv a.tmp/.git .
rm -rf a.tmp
git unstage # apparently git thinks all the files are deleted if you don't do this