Skip to content

Commit

Permalink
Merge pull request #473 from pre-commit/2_21_0
Browse files Browse the repository at this point in the history
add documentation for 2.11.0
  • Loading branch information
asottile committed Mar 7, 2021
2 parents 032ec6c + 193880f commit a12f914
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
15 changes: 14 additions & 1 deletion sections/advanced.md
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
14 changes: 7 additions & 7 deletions sections/cli.md
Expand Up @@ -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:
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
9 changes: 7 additions & 2 deletions sections/new-hooks.md
Expand Up @@ -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).
```
Expand Down Expand Up @@ -149,6 +149,7 @@ Hello from foo hook!
- [perl](#perl)
- [python](#python)
- [python_venv](#python_venv)
- [r](#r)
- [ruby](#ruby)
- [rust](#rust)
- [swift](#swift)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions sections/plugins.md
Expand Up @@ -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)
Expand Down

0 comments on commit a12f914

Please sign in to comment.