Skip to content

Instantly share code, notes, and snippets.

@elboletaire
Last active March 13, 2019 21:54
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 elboletaire/8492492 to your computer and use it in GitHub Desktop.
Save elboletaire/8492492 to your computer and use it in GitHub Desktop.
A bash method to get gitignore files from github gitignore's repo
get_gitignore() {
local gitignore=https://raw.github.com/github/gitignore/master/$1.gitignore
local exists=`curl -s --head -w %{http_code} $gitignore -o /dev/null`
if [[ $exists -eq 404 ]]; then
echo "El gitignore esmentat no existeix. Comprova que l'has escrit be"
else
curl -s https://raw.githubusercontent.com/github/gitignore/master/$1.gitignore
fi
}
alias get-gitignore="get_gitignore"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment