Merge git repo into branch of another repo

后端 未结 3 1601
借酒劲吻你
借酒劲吻你 2020-12-04 05:06

Given repo Foo and repo Bar. I want to merge Bar with Foo, but only into a separate branch, called baz.

git checkout -b baz <=

3条回答
  •  情深已故
    2020-12-04 05:20

    Updated with "real-life" commands:

    Start from your repo directory, make sure your working copy is clean (no files changed, added or removed).


    Make a new branch:

    git checkout -b

    Add the secondary remote, then fetch it:

    git remote add  git@github.com:xxx/.git
    git remote update
    

    Merge one of their branches in your current branch:

    git merge /


    If you don't know which you want, then go for master

    If you are sure you want to accept all remote changes and avoid conflicts (overwrite yours) then you can specify -X theirs as option for git merge in the last step.

    If you want to add it in a subdirectory then probably you should probably use git submodules

提交回复
热议问题