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
<=
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