How do I clone into a non-empty directory?

前端 未结 16 1610
庸人自扰
庸人自扰 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:41

    I liked Dale's answer, and I also added

    git clone --depth 2 --no-checkout repo-to-clone existing-dir/existing-dir.tmp
    git branch dev_new214
    git checkout dev_new214
    git add .
    git commit
    git checkout dev
    git merge dev_new214
    

    The shallow depth avoided a lot of extra early dev commits. The new branch gave us a good visual history that there was some new code from this server that was placed in. That is the perfect use branches in my opinion. My thanks to the great insight of all the people who posted here.

提交回复
热议问题