Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Extract individual files from a Github repository
#!/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
#!/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
You can’t perform that action at this time.