Skip to content

Instantly share code, notes, and snippets.

@git2samus
Forked from afontaine/git-ignore
Created July 9, 2013 20:44
Show Gist options
  • Save git2samus/5961107 to your computer and use it in GitHub Desktop.
Save git2samus/5961107 to your computer and use it in GitHub Desktop.
#!/bin/sh
USAGE="list | <types> ..."
LONG_USAGE="Generate/Append the repo's .gitignore file using the gitignore.io api
`curl -s http://gitignore.io/api/`"
SUBDIRECTORY_OK=
OPTIONS_SPEC=
. "$(git --exec-path)/git-sh-setup"
require_work_tree_exists
cd_to_toplevel
total=$#
if [ $total -eq 0 ]; then
usage
fi
for item in $@; do
if [ $item == 'list' ]; then
continue;
fi
done
LIST=$1
for (( i = 2; i <= $#; i++ )); do
eval "LIST=$LIST,\${${i}}"
done
GITIGNORE="`curl -s http://gitignore.io/api/$LIST`"
echo "$GITIGNORE"
echo "$GITIGNORE" >> .gitignore
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment