Skip to content

Instantly share code, notes, and snippets.

@nightsparc
Forked from judy2k/gitignore
Created March 4, 2019 12:13
Show Gist options
  • Save nightsparc/6752c7c9b0aa2d04975f2138e1db75df to your computer and use it in GitHub Desktop.
Save nightsparc/6752c7c9b0aa2d04975f2138e1db75df 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