An open API service indexing awesome lists of open source software.

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.

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
```