Skip to content

Instantly share code, notes, and snippets.

@codegefluester
Last active December 31, 2015 13:39
Show Gist options
  • Select an option

  • Save codegefluester/7994331 to your computer and use it in GitHub Desktop.

Select an option

Save codegefluester/7994331 to your computer and use it in GitHub Desktop.
Fetches a gitignore template from Github and adds it to the repo.
#!/bin/sh
# Example: git-ignore.sh Objective-C
template=$1
currentDir=`pwd`
if [ $template ]
then
echo "Fetching https://raw.github.com/github/gitignore/master/$template.gitignore"
curl https://raw.github.com/github/gitignore/master/$template.gitignore -o "$currentDir/.gitignore"
cd "$currentDir"
git add .gitignore
git commit -m "Updated .gitignore"
else
echo "Missing template name, see https://github.com/github/gitignore for a list of available templates"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment