Skip to content

Instantly share code, notes, and snippets.

@marcuslilja
Last active December 22, 2015 22:49
Show Gist options
  • Save marcuslilja/6542899 to your computer and use it in GitHub Desktop.
Save marcuslilja/6542899 to your computer and use it in GitHub Desktop.
Simple bash script to clone repository boilerplate repository and remove .git folder inside. Timesaver when creating new projects.
#!/bin/sh
# Store the git repository url
REPOSITORY="git@github.com:marcuslilja/html5-boilerplate-grunt.git"
# Fetch all arguments
args=("$@")
# Count the number of arguments
number_of_arguments=${#args[@]}
# Check that number of arguments is not less than or equal to 0. If that
# is true, exit with status 1
if [ ${number_of_arguments} -le "0" ]
then exit 1
fi
# Set the first argument to be the project name
PROJECT_NAME=${args[0]}
# Clone the repository to project folder
git clone ${REPOSITORY} ${PROJECT_NAME}
# Enter the project folder
cd ${PROJECT_NAME}
# Remove git folder
rm -rf .git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment