Skip to content

Instantly share code, notes, and snippets.

@iluwatar
Created February 21, 2015 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iluwatar/63e676f80e3e9cec0350 to your computer and use it in GitHub Desktop.
Save iluwatar/63e676f80e3e9cec0350 to your computer and use it in GitHub Desktop.
git_merge_branches
cd <work dir>/<dst repository>
git remote add -f <src repository1> <work dir>/<src repository1>
git fetch -n <src repository1>
git checkout <branch>
git branch --set-upstream <branch> <src repository1>/<branch>
git merge --no-edit <src repository1>/<branch>
git remote rm <src repository1>
git remote add -f <src repository2> <work dir>/<src repository2>
git fetch -n <src repository2>
git branch --set-upstream <branch> <src repository2>/<branch>
git merge --no-edit <src repository2>/<branch>
git remote rm <src repository2>
# ... repeat for src repositories 3-5, and finally ...
git push -u origin <branch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment