Skip to content

Instantly share code, notes, and snippets.

@paoloambrosio
Created November 14, 2015 10:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paoloambrosio/0c4ee240e58e04fa79e4 to your computer and use it in GitHub Desktop.
Save paoloambrosio/0c4ee240e58e04fa79e4 to your computer and use it in GitHub Desktop.
How to merge multiple git repositories
#!/bin/bash
# This script merges several git repositories named experiment-<name>
# into a separate branch of a single repository.
mkdir global-repo
cd global-repo
git init
git remote add origin git@github.com:paoloambrosio/experiments.git
echo "Each experiment is committed in its own branch" >>README.txt
git add .
git commit -m 'Possibly the only commit on master'
for repo in wiremock-saboteur jmx-vs-agent dssim akka-http-auth packer sysintsim; do
git remote add $repo git@github.com:paoloambrosio/experiment-$repo.git
git fetch $repo
git checkout -b $repo $repo/master
done
git push --all origin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment