Git Clients

CaptainHook – flexible Git hook manager

CaptainHook is a Git hook manager for PHP developers that centralises automated checks and maintenance tasks in a JSON configuration file. Instead of maintaining separate hook scripts in each developer’s local Git directory, teams can define the actions to execute at different stages of the Git workflow and share those settings through version control.

The software can validate changes before commits and pushes, prepare commit messages, and perform maintenance after repository operations. Actions can invoke external commands or custom PHP code, with conditions controlling when individual tasks should run.

CaptainHook is particularly useful for teams seeking consistent development practices without writing and maintaining their own Git hook management infrastructure. Important checks should still run in continuous integration because developers can bypass local hooks.

This is free and open source software.

Key Features

  • Configures Git hooks through a captainhook.json file containing individual hook definitions and action lists.
  • Supports pre-commit, pre-push, prepare-commit-msg, commit-msg, post-commit, post-checkout, post-merge and other Git hooks.
  • Provides virtual hooks such as post-change, triggered by multiple related Git events.
  • Executes external commands, test suites, linters and code quality tools.
  • Includes built-in validators for checking commit messages against predefined rules.
  • Supports custom PHP action classes and methods for implementing project-specific checks.
  • Conditional action execution based on changed files, command results and other criteria.
  • Combines conditions using logical AND and OR operations.
  • Supports placeholders for staged files, changed files, hook arguments and environment variables.
  • Allows configuration files to include other CaptainHook configurations for sharing reusable settings.
  • Supports enabling or disabling individual hooks and configuring their actions independently.
  • Provides configurable execution settings, including Docker-based execution.

Website: github.com/captainhook-git/captainhook
Support:
Developer: Sebastian Feldmann
License: MIT License

CaptainHook is written in PHP. Learn PHP with our recommended free books and free tutorials.


Related Software

Git Hook Managers
lefthookGit hooks manager for Node.js, Ruby, Python and more
huskyGit hooks made easy
pre-commitManage and maintain multi-language pre-commit hooks
GrumPHPAutomates PHP code quality checks through configurable Git hooks
prekReimagined version of pre-commit
overcommitManage and configure Git hooks
hkGit hooks manager and project linting tool focusing on performance
simple-git-hooksSimple git hooks manager for small projects
CaptainHookFlexible Git hook manager
GithooksPlatform-independent hooks manager
git-hooksRewritten from icefox/git-hooks, with extra features
AutohookRuns and organises Git hook scripts using a single Bash script
JigGit pre-commit hook on steroids

Read our verdict in the software roundup.


Best Free and Open Source Software LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.

We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more.

Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion.

Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README.
Subscribe

Please read our Comment Policy before commenting.

Notify of
guest
0 Comments
Oldest
Newest Most Voted