-
-
Save goakley/5478064 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# subtree merge with branches | |
rm -rf commcare-hq core-hq | |
git clone git://github.com/dimagi/commcare-hq.git | |
git clone git://github.com/dimagi/core-hq.git | |
cd core-hq | |
git checkout master | |
git rm .gitignore README.rst | |
git commit -m "remove .gitignore in preparation for merge" | |
branches=$(git branch --remote --no-merged | cut -d/ -f 2) | |
for branch in $branches; do | |
git checkout -b $branch origin/$branch | |
git rm .gitignore README.rst | |
git rm __init__.py | |
git commit -m "remove .gitignore in preparation for merge" | |
done | |
branches="master $branches" | |
cd ../commcare-hq | |
git rm submodules/core-hq-src | |
git commit -m "remove core-hq-src submodule" | |
git remote add -f core-hq ../core-hq/.git | |
for branch in $branches; | |
do | |
echo subtree merging $branch | |
git checkout master | |
git checkout -b core-hq-$branch | |
git merge -s ours --no-commit core-hq/$branch | |
git read-tree --prefix= -u core-hq/$branch | |
git commit -m "subtree merged in core-hq ($branch branch)" | |
done | |
git checkout master | |
git merge core-hq-master | |
for branch in $branches; | |
do | |
git checkout -f core-hq-$branch | |
git merge --no-edit master | |
done | |
# git push --all origin | |
exit 0 | |
# anyone with a fork of core-hq can do the following to merge their changes into their fork of commcare-hq | |
cd core-hq-src | |
git rm .gitignore README.rst | |
git commit -m "remove conflicting files" | |
cd ../../ | |
git remote add -f core-hq submodules/core-hq-src/.git | |
git merge -s ours --no-commit core-hq/mybranch | |
git read-tree --prefix= -u core-hq/mybranch | |
git commit -m "subtree merged in core-hq (mybranch branch)" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment