Skip to content

A pre-commit hook to prevent commits in a specified list of branches

License

Notifications You must be signed in to change notification settings

PaperNick/pre-commit-forbidden-branches

Repository files navigation

Pre-commit hook to forbid commits

Test Status

The purpose of this pre-commit hook is to prevent accidental commits in a specified list of branches, e.g. master, develop, etc.

Dependencies:

Installation

If this is your first time configuring pre-commit, follow the installation instructions: https://pre-commit.com/#install

Add this to your .pre-commit-config.yaml file under the repos key:

- repo: https://github.com/PaperNick/pre-commit-forbidden-branches
  rev: 0.3.0
  hooks:
  - id: forbid-commits-hook
    args: ['master']
    pass_filenames: false

Specify the forbidden branches

You can use the args key to specify more than one branch:

args: ['master', 'develop']

Development

Create a virtual environment:

python3 -m venv venv/

Activate the venv:

source venv/bin/activate

Install the development requirements:

pip install -r requirements_dev.txt

Run the tests:

python -m pytest tests/ --cov pre_commit_hook/
bash tests/integration/run.sh

About

A pre-commit hook to prevent commits in a specified list of branches

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published