Skip to content

Instantly share code, notes, and snippets.

@judy2k
Last active February 1, 2022 11:14
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save judy2k/9930888 to your computer and use it in GitHub Desktop.
Save judy2k/9930888 to your computer and use it in GitHub Desktop.
A script to manage a .gitignore file
#!/bin/bash
# To add two items to the current .gitignore file:
# gitignore '*.swp' bin
#
# To sort and de-dupe the current .gitignore file:
# gitignore
# Append each argument to its own line:
for item in "$@"; do
echo "$item" >> .gitignore;
done
# Remove duplicates (and sort):
sort -u .gitignore -o .gitignore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment