Last active
February 1, 2022 11:14
-
-
Save judy2k/9930888 to your computer and use it in GitHub Desktop.
A script to manage a .gitignore file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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