Last active
April 5, 2018 14:36
-
-
Save brevans/c7397e1d7b7b6c5f3f06c463cc6cc30e 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
# clone repo I want subtree from | |
git clone [email protected]:caseywdunn/agalma.git | |
cd agalma | |
# be paranoid and remove origin so I don't push back to origin | |
git remote rm origin | |
# filter subtree I want | |
git filter-branch --prune-empty --subdirectory-filter dev/conda master | |
# move subtree to match destination directory structure, maintaining history | |
git filter-branch -f --index-filter 'git ls-files -s | sed "s-\t\"*-&recipes/-" | GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' HEAD | |
# clean up | |
git rm -r recipes/agalma | |
git commit -m "remove the agalma recipe" | |
cd .. | |
# clone destination repo | |
git clone [email protected]:caseywdunn/conda-recipes.git | |
cd conda-recipes | |
# add my subtree as a remote | |
git remote add agalma ../agalma | |
git fetch --all | |
# merge | |
git merge --allow-unrelated-histories agalma/master -m "merging agalma recipes into new recipe repo" | |
# clean and push | |
git remote rm agalma | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment