Skip to content

Instantly share code, notes, and snippets.

@IljaN
Created November 18, 2017 20:14
Show Gist options
  • Save IljaN/28fd7d2b086b545d843286ea95248921 to your computer and use it in GitHub Desktop.
Save IljaN/28fd7d2b086b545d843286ea95248921 to your computer and use it in GitHub Desktop.
Merge Repos
# create a new repo:
git init all_projects
cd all_project
# to make it more easy to understand, let's create a new branch
git checkout -b main
# import 1st project
git remote add projectA http://projectA
git fetch --all --tags
git checkout masterA projectA/master
git rebase masterA main
# move the main branch to the current state
git branch main -f
# Now your branch main is at the same state as your A project
# import 2st project
git remote add projectB http://projectB
git fetch --all --tags
git checkout masterB projectB/master
git rebase masterB main
# move the main branch to the current state
git branch main -f
# Now your branch main contains all commits from projectA and projectB
# etc..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment