Skip to content

Instantly share code, notes, and snippets.

@ayharano
Last active December 18, 2018 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ayharano/388c4dfa78312f18cfa56192e404bd3e to your computer and use it in GitHub Desktop.
Save ayharano/388c4dfa78312f18cfa56192e404bd3e to your computer and use it in GitHub Desktop.
Global gitignore populate from github
#!/usr/bin/env bash
URL_PREFIX='https://raw.githubusercontent.com/github/gitignore/master/'
URL_SUFFIX='.gitignore'
GLOBAL_IGNORE=~/.config/git/ignore
mkdir -p "${GLOBAL_IGNORE}" && rmdir "${GLOBAL_IGNORE}"
echo -n > "${GLOBAL_IGNORE}"
pushd /tmp
for IGNORE in {Linux,Windows,macOS,Vim,Emacs,JetBrains,SublimeText,VisualStudioCode,Ansible,VirtualEnv}; do
URL="${URL_PREFIX}Global/${IGNORE}${URL_SUFFIX}"
curl -O "${URL}" && echo "## ${URL} -- $(date +%Y%m%d)" >> "${GLOBAL_IGNORE}" && cat "${IGNORE}${URL_SUFFIX}" >> "${GLOBAL_IGNORE}" && echo >> "${GLOBAL_IGNORE}"
done
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment