Created
November 19, 2014 16:35
-
-
Save aaren/0fab3586c056184f3b3b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# This is a script for migrating the python lesson out of | |
# bc/novice/python into swc-novice-python and then into the | |
# new lesson template (lesson-template) | |
# https://github.com/swcarpentry/workshop-template/pull/61 | |
if [[ ! -d bc ]]; then | |
git clone https://github.com/swcarpentry/bc | |
cd bc | |
else | |
cd bc | |
git checkout gh-pages | |
git pull | |
fi | |
# use subtree to filter out the novice/python directory | |
# into a new branch 'novice-python-history' | |
git subtree split -P novice/python -b novice-python-history && | |
git checkout novice-python-history && | |
# attach missed older history (from bc reorgs) | |
# https://github.com/wking/swc-modular-shell/issues/3 | |
# (lesson now in novice/python used to be in python/novice) | |
# goto the commit before the reorg | |
git checkout -b python-novice b8c7dc3^ && | |
# move python/novice to root and rewrite all commits accordingly | |
git filter-branch -f --subdirectory-filter python/novice --prune-empty && | |
# now rebase to add this to the history | |
git checkout novice-python-history && | |
ORPHAN_COPY_COMMIT=$(git rev-parse 'HEAD^{/Reorganizing material}') && | |
git rebase -p --onto python-novice "${ORPHAN_COPY_COMMIT}" && | |
# delete the temp branch | |
git branch -D python-novice && | |
# pull this branch into 'novice-python-history' branch of | |
# new repo (swc-novice-python) | |
cd .. | |
cd swc-novice-python | |
git checkout novice-python-history && | |
git pull --force ../bc novice-python-history | |
# all of the files are now in the root, so we need to move them | |
# into pages/ before importing to the lesson template | |
# git filter-branch --tree-filter 'mkdir -p pages; mv * pages || true;' HEAD | |
# now pull into workshop-template | |
# cd .. | |
# git clone [email protected]:pipitone/workshop-template | |
# cd workshop-template | |
# git checkout -b pr-import-bc-setup-history | |
# git pull ../bc setup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@r-gaia-cs regarding the prune empty issue I think the problem is that
git subtree
doesn't take--prune-empty
as an argument.I should be able to do the same thing with filter-branch. Currently I'm using:
Should replace with this: