https://github.com/ali-hv/check-revert-comments
A pre-commit hook that prevents committing files containing # REVERT markers.
https://github.com/ali-hv/check-revert-comments
git hook pre-commit pre-commit-hooks precommit
Last synced: 4 months ago
JSON representation
A pre-commit hook that prevents committing files containing # REVERT markers.
- Host: GitHub
- URL: https://github.com/ali-hv/check-revert-comments
- Owner: ali-hv
- License: gpl-3.0
- Created: 2025-09-07T13:11:50.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2025-09-07T19:36:58.000Z (4 months ago)
- Last Synced: 2025-09-07T21:25:08.370Z (4 months ago)
- Topics: git, hook, pre-commit, pre-commit-hooks, precommit
- Language: Shell
- Homepage:
- Size: 16.6 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# check-revert-comments
A [pre-commit](https://pre-commit.com/) hook that prevents committing files containing `# REVERT` markers.
Use this when you add temporary debug/testing code with a `# REVERT` comment above it, and want to ensure you never accidentally commit it.
---
## 🚀 Installation
1. Install [pre-commit](https://pre-commit.com/#installation) if you don’t have it yet:
```bash
pip install pre-commit
```
2. Add this hook to your project’s .pre-commit-config.yaml:
```bash
repos:
- repo: https://github.com/your-org/check-revert-comments
rev: v1.0.0 # or a specific commit SHA / tag
hooks:
- id: check-revert-comments
```
3. Install the hooks into your repo:
```bash
pre-commit install
```
## đź§Ş Example
If you stage a file with:
```python
for i in items:
# REVERT
break
```
The commit will be blocked:
```bash
❌ Commit blocked: Found "# REVERT" markers:
File: src/test_script.py
12: # REVERT
```