diff --git a/sections/advanced.md b/sections/advanced.md index 9942c345..d2d8d804 100644 --- a/sections/advanced.md +++ b/sections/advanced.md @@ -64,6 +64,19 @@ manually edited during conflict resolution. This also includes files which were automatically merged by git. Git isn't perfect and this can often catch implicit conflicts (such as with removed python imports). +_new in 2.11.0_ pre-commit can be used to manage [post-merge] hooks. + +To use `post-merge` hooks with pre-commit, run: + +```console +$ pre-commit install --hook-type post-merge +pre-commit installed at .git/hooks/post-merge +``` + +The hook fires after a successful `git merge`. + +[post-merge]: https://git-scm.com/docs/githooks#_post_merge + ## pre-commit during clean merges _new in 1.21.0_ pre-commit can be used to manage [pre-merge-commit] hooks. @@ -187,7 +200,7 @@ to run at the `push` stage. Hooks can however be confined to a stage by setting the [`stages`](#config-stages) property in your `.pre-commit-config.yaml`. The [`stages`](#config-stages) property is an array and can contain any of `commit`, `merge-commit`, `push`, `prepare-commit-msg`, -`commit-msg` and `manual`. +`commit-msg`, `post-checkout`, `post-commit`, `post-merge`, and `manual`. If you do not want to have hooks installed by default on the stage passed during a `pre-commit install --hook-type ...`, please set the [`default_stages`](#top_level-default_stages) diff --git a/sections/cli.md b/sections/cli.md index 9fe1d373..a22752b1 100644 --- a/sections/cli.md +++ b/sections/cli.md @@ -95,8 +95,8 @@ Install hook script in a directory intended for use with Options: -- `-t {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit}`, - `--hook-type {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit}`: +- `-t {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit,post-merge}`, + `--hook-type {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit,post-merge}`: which hook type to install. Some example useful invocations: @@ -132,8 +132,8 @@ Options: - `--install-hooks`: Also install environments for all available hooks now (rather than when they are first executed). See [`pre-commit install-hooks`](#pre-commit-install-hooks). -- `-t {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit}`, - `--hook-type {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit}`: +- `-t {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit,post-merge}`, + `--hook-type {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit,post-merge}`: Specify which hook type to install. - `--allow-missing-config`: Hook scripts will permit a missing configuration file. @@ -238,6 +238,6 @@ Uninstall the pre-commit script. Options: -- `-t {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg}`, - `--hook-type {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg}`: which hook - type to uninstall. +- `-t {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit,post-merge}`, + `--hook-type {pre-commit,pre-merge-commit,pre-push,prepare-commit-msg,commit-msg,post-checkout,post-commit,post-merge}`: + which hook type to uninstall. diff --git a/sections/new-hooks.md b/sections/new-hooks.md index 25ca4301..def823cb 100644 --- a/sections/new-hooks.md +++ b/sections/new-hooks.md @@ -75,8 +75,8 @@ file that tells pre-commit: =r= =c= [`stages`](_#hooks-stages) =c= (optional: default (all stages)) confines the hook to the `commit`, `merge-commit`, - `push`, `prepare-commit-msg`, `commit-msg`, `post-checkout`, `post-commit`, or - `manual` stage. See + `push`, `prepare-commit-msg`, `commit-msg`, `post-checkout`, `post-commit`, + `post-merge`, or `manual` stage. See [Confining hooks to run at certain stages](#confining-hooks-to-run-at-certain-stages). ``` @@ -149,6 +149,7 @@ Hello from foo hook! - [perl](#perl) - [python](#python) - [python_venv](#python_venv) +- [r](#r) - [ruby](#ruby) - [rust](#rust) - [swift](#swift) @@ -346,6 +347,10 @@ instead. __Support:__ python hooks work without any system-level dependencies. It has been tested on linux, macOS, windows, and cygwin. +### r + +_new in 2.11.0_ + ### ruby The hook repository must have a `*.gemspec`. It will be installed via diff --git a/sections/plugins.md b/sections/plugins.md index 1c98a6da..57c38007 100644 --- a/sections/plugins.md +++ b/sections/plugins.md @@ -142,8 +142,8 @@ repository's configuration. =r= =c= [`stages`](_#config-stages) =c= (optional) confines the hook to the `commit`, `merge-commit`, `push`, - `prepare-commit-msg`, `commit-msg`, `post-checkout`, `post-commit`, or - `manual` stage. See + `prepare-commit-msg`, `commit-msg`, `post-checkout`, `post-commit`, + `post-merge`, or `manual` stage. See [Confining hooks to run at certain stages](#confining-hooks-to-run-at-certain-stages). =r= =c= [`additional_dependencies`](_#config-additional_dependencies)