Crate git_branchless_hook

source ·
Expand description

Callbacks for Git hooks.

Git uses “hooks” to run user-defined scripts after certain events. We extensively use these hooks to track user activity and e.g. decide if a commit should be considered obsolete.

The hooks are installed by the branchless init command. This module contains the implementations for the hooks.

Functions§

  • hook subcommand.
  • For rebases, detect empty commits (which have probably been applied upstream) and write them to the rewritten-list file, so that they’re later passed to the post-rewrite hook.
  • Handle Git’s post-rewrite hook.
  • For rebases, register that extra cleanup actions should be taken when the rebase finishes and calls the post-rewrite hook. We don’t want to change the behavior of git rebase itself, except when called via git-branchless, so that the user’s expectations aren’t unexpectedly subverted.
  • For rebases, if a commit is known to have been applied upstream, skip it without attempting to apply it.