How do you merge two Git repositories?

后端 未结 23 4138
耶瑟儿~
耶瑟儿~ 2020-11-21 05:45

Consider the following scenario:

I have developed a small experimental project A in its own Git repo. It has now matured, and I\'d like A to be part of larger projec

23条回答
  •  天命终不由人
    2020-11-21 06:09

    To merge a A within B:

    1) In the project A

    git fast-export --all --date-order > /tmp/ProjectAExport
    

    2) In the project B

    git checkout -b projectA
    git fast-import --force < /tmp/ProjectAExport
    

    In this branch do all operations you need to do and commit them.

    C) Then back to the master and a classical merge between the two branches:

    git checkout master
    git merge projectA
    

提交回复
热议问题