How do I clone into a non-empty directory?

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

    The following worked for me. First I'd make sure the files in the a directory are source-controlled:

    $ cd a
    $ git init
    $ git add .
    $ git commit -m "..."
    

    Then

    $ git remote add origin https://URL/TO/REPO
    $ git pull origin master --allow-unrelated-histories
    $ git push origin master
    

提交回复
热议问题