A flexible tool to update your .gitignore
file with common patterns for various programming languages and environments.
- Easily extendable to support new pattern sets
- Command-line interface with flags for each supported pattern set
- Automatically creates .gitignore file if it doesn't exist
- Adds patterns without duplicating existing entries
To use this tool, you need both the main script and the patterns folder. To get started:
- Clone the repo
git clone https://github.com/griffinbaker12/git-ignore-updater.git
cd git-ignore-updater
chmod +x git_ignore_updater.py
- Set up an alias (optional, but recommended)
Add this line to your shell configuration file (e.g., .bashrc, .zshrc):
alias update-gitignore="./path/to/git_ignore_updater.py"
Replace /path/to/git_ignore_updater.py
with the actual path where you saved the script.
Run the script in your project directory:
./path/to/git_ignore_updater.py [OPTIONS]
Or, if you set up an alias:
update-gitignore [OPTIONS]
--python
: add Python patterns (default if no options selected)- ... (insert your custom option here)
You can combine multiple options:
./git_ignore_updater.py --python --your-custom-option
- Navigate to the patterns directory.
- Create a new text file named after the language or environment (e.g., rust.txt).
- Add the patterns, one per line.
- The script will automatically recognize the new pattern set and add a corresponding command-line option.
Please feel free to open a PR to add a cli argument for any patterns that you catch yourself typing a lot!