/pyGitHook

Various useful Git Hooks written in Python :warning: Now hosted on Gitlab

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

⚠️ This project is now hosted on Gitlab; switch to it to get newer versions.

pyGitHook

Codacy Badge

This repository provides various useful Git Hooks written in Python.

History

This project was initially created to answer this issue on StackOverflow.

The needs was to prevent merging from 'testing' branch in something else than the 'master' one.

References

If you need to learn Git Hook, check the official Git Book

You can easily integrate with various code hosting platform, for instance:

Usage

To fit PEP8 Style Guide, file name uses _ instead of -, and .py extension.

You just need to download the hook(s) you want, and put them in the .git/hooks/ sub-directory of your repository.

When moving file to your .git/hooks/ sub-directory, you then must rename the file accordingly, to fit what Git awaits.

Prevent merging between some branches

For this feature, you need the prepare_commit_msg.py hook.

Installation:

  • copy file to the .git/hooks/ sub-directory of your repository, and rename it to prepare-commit-msg
  • edit configuration at beginning of the hook to match your source/destination branches rules

Contributing

Don't hesitate to contribute or to contact me if you want to improve the project.

You can report issues or request features and propose merge requests.

Versioning

The versioning scheme we use is SemVer.

Authors

Bertrand BENOIT

License

This project is under the GPLv3 License - see the LICENSE file for details.