How do I clone into a non-empty directory?

前端 未结 16 1296
庸人自扰
庸人自扰 2020-11-22 06:20

I have directory A with files matching directory B. Directory A may have other needed files. Directory B is a git repo.

I want to clone directory B to directory A bu

16条回答
  •  盖世英雄少女心
    2020-11-22 06:34

    I have used this a few moments ago, requires the least potentially destructive commands:

    cd existing-dir
    git clone --bare repo-to-clone .git
    git config --unset core.bare
    git remote rm origin
    git remote add origin repo-to-clone
    git reset
    

    And voilá!

提交回复
热议问题