Last active
January 4, 2016 20:19
-
-
Save matthijskooijman/8673439 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 -ex | |
git clone [email protected]:arduino/Arduino.git Arduino2 | |
# cleaning up the Arduino repo | |
cd Arduino2 | |
git branch -t ide-1.5.x origin/ide-1.5.x | |
git remote rm origin | |
git tag -l | xargs git tag -d | |
git checkout ide-1.5.x | |
git branch -D master | |
git branch master | |
git checkout master | |
git branch -D ide-1.5.x | |
git filter-branch --tag-name-filter cat --prune-empty --index-filter \ | |
'git ls-files -s | | |
grep -P -v "\\t\"*hardware/atmel/sam/" | | |
grep -P -v "\\t\"*hardware/tools/" | | |
sed "s-\\(\\t\"*\\)hardware/arduino/sam/-\1sam/-" | | |
sed "s-\\(\\t\"*\\)hardware/google/sam/-\1sam/google/-" | | |
sed "s-\\(\\t\"*\\)hardware/sam/-\1sam/-" | | |
sed "s-\\(\\t\"*\\)hardware/atmel/-\1sam/-" | | |
sed "s-\\(\\t\"*\\)hardware/arduino/avr/-\1avr/-" | | |
sed "s-\\(\\t\"*\\)hardware/arduino/-\1avr/-" | | |
sed "s-\\(\\t\"*\\)hardware/avr/-\1avr/-" | | |
sed "s-\\(\\t\"*\\)hardware/-\1avr/-" | | |
sed "s-\\(\\t\"*\\)targets/-\1avr/-" | | |
( git ls-files --error-unmatch core/global.h > /dev/null 2> /dev/null && sed "s-\\(\\t\"*\\)core/-\1avr/-" || cat ) | | |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new git update-index --index-info && | |
( ! [ -f "$GIT_INDEX_FILE.new" ] || mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE" )' -- --all | |
cd - | |
# creating a new "master" branch with only the contents (and history) of hardware/arduino/avr | |
git clone Arduino2 temp-core-avr | |
cd temp-core-avr | |
git remote rm origin | |
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter avr -- --all | |
git reset --hard | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
git reflog expire --expire=now --all | |
git gc --aggressive --prune=now | |
git remote add origin [email protected]:matthijskooijman/arduino-platform-avr.git | |
git push origin master | |
cd - | |
# creating a new "master" branch with only the contents (and history) of hardware/arduino/sam | |
git clone Arduino2 temp-core-sam | |
cd temp-core-sam | |
git remote rm origin | |
git filter-branch --tag-name-filter cat --prune-empty --subdirectory-filter sam -- --all | |
git reset --hard | |
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d | |
git reflog expire --expire=now --all | |
git gc --aggressive --prune=now | |
git remote add origin [email protected]:matthijskooijman/arduino-platform-sam.git | |
git push origin master | |
cd - |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment