Last active
March 16, 2019 14:02
-
-
Save uliwitness/cbb9e3b51f1aba71a633658de3e145b4 to your computer and use it in GitHub Desktop.
Extract individual files from a Github repository
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 | |
GIT='/Applications/Xcode.app/Contents/Developer/usr/bin/git' | |
#$SOURCEREPO=$1 | |
#$DESTREPO=$2 | |
SOURCEREPO=/Users/uli/Programming/FileExplorer/UliKit | |
DESTREPO=/Users/uli/Programming/FileExplorer/ULIXattrMetadataStore | |
MYDIR=`dirname "$0"` | |
$GIT clone --no-hardlinks "$SOURCEREPO" "$DESTREPO" | |
echo "===== REMOVE REPO CONNECTIONS: =====" | |
cd "$DESTREPO" | |
$GIT remote rm origin | |
$GIT tag -l | xargs $GIT tag -d | |
echo "===== FILTER START: =====" | |
git filter-branch --prune-empty --index-filter "git ls-files | sed \"s/'/\\\'/g\" | sed 's/\"/\\\\\"/g' | grep -vE 'UKXattrMetadataStore.h|UKXattrMetadataStore.m|.gitmodules|.gitignore' | \"$MYDIR/quietxargs.sh\"" | |
echo "===== FILTER END. =====" | |
$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 |
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 | |
xargs -0 -I{} git rm -rf --cached --ignore-unmatch "{}" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment