Created
November 11, 2014 16:46
-
-
Save davegurnell/20c1440cb9352d225ae0 to your computer and use it in GitHub Desktop.
Shell script: publish examples and solutions to github without their histories
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
#!/usr/bin/env bash | |
git checkout master | |
git branch -D nohistory | |
for branch in `git branch | cut -c2-` | |
do | |
echo "========== $branch ==========" | |
git checkout $branch | |
git branch -D nohistory | |
git checkout --orphan nohistory | |
git commit -m 'Initial commit' | |
git push github ":$branch" | |
git push --force github "nohistory:$branch" | |
done | |
git checkout master | |
git branch -D nohistory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment