NAME

Git::Hooks::CheckRewrite - Git::Hooks plugin for checking against unsafe rewrites

VERSION

version 4.0.0

SYNOPSIS

As a Git::Hooks plugin you don't use this Perl module directly. Instead, you may configure it in a Git configuration file like this:

[githooks]

  # Enable the plugin
  plugin = CheckRewrite

  # These users are exempt from all checks
  admin = joe molly

This section enables the plugin and defines the users joe and molly as administrators, effectively exempting them from any restrictions the plugin may impose.

DESCRIPTION

This Git::Hooks plugin hooks itself to the pre-rebase hook to guarantee that it is safe in the sense that no rewritten commit is reachable by other branch than the one being rebased.

It also hooks itself to the pre-commit and the post-commit hooks to detect unsafe git commit --amend commands after the fact. An amend is unsafe if the original commit is still reachable by any branch after being amended. Unfortunately git still does not provide a way to detect unsafe amends before committing them.

To enable it you should add it to the githooks.plugin configuration option:

[githooks]
  plugin = CheckRewrite

NAME

Git::Hooks::CheckRewrite - Git::Hooks plugin for checking against unsafe rewrites

CONFIGURATION

There's no configuration needed or provided.

REFERENCES

Here are some references about what it means for a rewrite to be unsafe and how to go about detecting them in git:

AUTHOR

Gustavo L. de M. Chaves <gnustavo@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2024 by CPQD <www.cpqd.com.br>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.