I want to join two different git repositories into one repository with two branches. Is it possible? How?
To do a merge (locally), git checkout the branch you want to merge INTO. Then type git merge <branch> where <branch> is the branch you want to merge FROM. Because the history of master and the history of make_function share common ancestors and don't have any divergence descendents, we get a "fast-forward" merge.
To merge branches locally, use git checkout to switch to the branch you want to merge into. This branch is typically the main branch. Next, use git merge and specify the name of the other branch to bring into this branch. This example merges the jeff/feature1 branch into the main branch.
Create a new repository, then add both of these repositories as remotes:
git remote add origin1 ...
git remote add origin2 ...
Fetch from both:
git fetch origin1
git fetch origin2
Create a local branch to track a branch of each remote (assuming the master):
git branch branch1 origin1/master
git branch branch2 origin2/master
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With