Skip to content

Instantly share code, notes, and snippets.

@laurencer
Created April 17, 2015 07:40
Show Gist options
  • Save laurencer/4933db5349fa9937b765 to your computer and use it in GitHub Desktop.
Save laurencer/4933db5349fa9937b765 to your computer and use it in GitHub Desktop.
Merging Git Repositories togther
export prefix="ssh://git@???:7999/???/" # prefix for the repo
export suffix=".git" # suffix for the repo address
function merge() {
repo=$1
git remote add -f $repo ${prefix}${repo}${suffix}
git merge -s ours --no-commit ${repo}/master
git read-tree --prefix=${repo}/ -u ${repo}/master
git commit -m "Merged ${repo} subtree"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment