🛡️ Protect files from accidental Git commits
Project description
🛡️ NoStage
Protect files from accidental Git commits - even when you git add .
NoStage is a lightweight CLI tool that prevents specific files from being staged and committed, perfect for temporary debug files, experimental code, and personal workflow files that you don't want in your repository.
🎯 Why NoStage?
Ever had this happen?
# You're debugging with some test files
$ ls
debug.js test-output.txt my-feature.js ...
# You finish your work and commit everything
$ git add .
$ git commit -m "Add new feature"
# 😱 Oops! debug.js and test-output.txt are now committed!
NoStage solves this. Mark files as "protected" once, and they'll never be accidentally committed.
🆚 NoStage vs .gitignore
| Feature | .gitignore | NoStage |
|---|---|---|
| Scope | Team-wide, affects everyone | Personal, per-developer |
| Already tracked files | ❌ Can't ignore | ✅ Works on any file |
| Use case | Files that should NEVER be committed | Files you might commit LATER |
| Setup | Manual editing | Simple CLI commands |
| Dynamic | Static file | Easy add/remove on the fly |
Perfect for:
- 🐛 Debug/test files you create while developing
- 🧪 Experimental code you're not ready to commit
- 📝 Personal notes or scratch files
- 🔧 Local configuration tweaks
🚀 Installation
# Install via pip
pip install nostage
# Initialize in your git repository
cd your-project
nostage init
📖 Usage
Protect Files
# Protect specific files
nostage add debug.js test-output.txt scratch.py
# Now commit normally - protected files are auto-unstaged!
git add .
git commit -m "my changes"
# ✅ debug.js, test-output.txt, scratch.py won't be committed
Protect Patterns
# Protect all files matching a pattern
nostage pattern "*.temp.js"
nostage pattern "debug_*.py"
nostage pattern "scratch/*"
Manage Protection
# List all protected files and patterns
nostage list
# Remove protection from a file
nostage remove debug.js
# Remove a pattern
nostage remove-pattern "*.temp.js"
# Check status
nostage status
🎬 How It Works
-
You mark files for protection:
nostage add debug.js
-
NoStage installs a git pre-commit hook that runs automatically
-
When you commit:
git add . git commit -m "update"
-
Protected files are auto-unstaged:
🛡️ NoStage: Protecting 1 file(s) from commit: • debug.js -
Only your real work gets committed! ✨
💡 Examples
Scenario 1: Debugging
# You create a debug file
echo "console.log('debug')" > debug.js
# Protect it so you don't accidentally commit it
nostage add debug.js
# Work on your feature
vim feature.js
# Commit everything - debug.js is automatically protected!
git add .
git commit -m "Add feature"
Scenario 2: Experimental Code
# Protect experimental files
nostage add experiment.py
nostage pattern "test_*.py"
# Experiment freely
# When ready, remove protection and commit
nostage remove experiment.py
git add experiment.py
git commit -m "Add new algorithm"
Scenario 3: Team Project
# Each developer can protect their own files
# Alice protects her debug scripts
nostage add alice-debug.sh
# Bob protects his test data
nostage add test-data.json
# No .gitignore conflicts, everyone's happy! 🎉
🛠️ Commands
| Command | Description |
|---|---|
nostage init |
Install NoStage hook in current repo |
nostage add <files...> |
Protect specific files |
nostage remove <files...> |
Unprotect specific files |
nostage pattern <pattern> |
Protect files matching pattern |
nostage remove-pattern <pattern> |
Remove pattern protection |
nostage list |
Show all protected files/patterns |
nostage status |
Show NoStage status |
nostage uninstall |
Remove NoStage hook |
⚙️ Requirements
- Python 3.7+
- Git
🤝 Contributing
Contributions are welcome! Feel free to:
- Report bugs
- Suggest features
- Submit pull requests
📝 License
MIT License - feel free to use in your projects!
🌟 Show Your Support
If NoStage helps you, give it a ⭐ on GitHub!
Made with ❤️ by developers who've accidentally committed debug files one too many times.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nostage-0.1.0.tar.gz.
File metadata
- Download URL: nostage-0.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2246063762874cbd200ab774c149dc7e229fa2d84bb04d2e93845521530db2a7
|
|
| MD5 |
6a405accf9d62e9763c69352f88db367
|
|
| BLAKE2b-256 |
0dbe99d6504b5bc20ed7c25a175625ed31fb6a784b38386d4fa25b06e80d0d17
|
File details
Details for the file nostage-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nostage-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
936565e08f44820a70e26fee6722463855082c5f2bef3fb475e923c8ddc0c8c4
|
|
| MD5 |
d5eb9c80f9ec528eabdd1138e26e54f2
|
|
| BLAKE2b-256 |
8c583f051d4e0ef2a8fc42a6e091c09278e449f6867edb697af1672cc7ba8908
|