Skip to content

Instantly share code, notes, and snippets.

@yorkie
Created December 20, 2013 15:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorkie/8056734 to your computer and use it in GitHub Desktop.
Save yorkie/8056734 to your computer and use it in GitHub Desktop.
download github folder and project without cloning...
#####################################################
# Download Specific folders from Github using SVN
#
# Author: Declan Cook
# Licence: MIT
#####################################################
GHDOMAIN="https://github.com/"
IN=$1
IN=${IN##$GHDOMAIN}
BRANCH="trunk"
FOLDER=""
IFS="/" read -a SECT <<< "$IN"
if [[ "${SECT[3]}" != "master" ]]; then
BRANCH=${SECT[3]}
fi
for index in "${!SECT[@]}"; do
if [ $index -gt 3 ]; then
FOLDER=$FOLDER/${SECT[index]}
fi
done
# DOMAIN/USER/PROJECT/<TRUNK||BRANCH>/FOLDER
echo Exporting $GHDOMAIN${SECT[0]}/${SECT[1]}/$BRANCH$FOLDER
svn export $GHDOMAIN${SECT[0]}/${SECT[1]}/$BRANCH$FOLDER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment