Skip to content

Commit

Permalink
docs: improve updating pre-commit documentation (#1361)
Browse files Browse the repository at this point in the history
- there was a inconsistence between the inline and rej default. as it's inline I changed the value in the corrected section
- as users won't need the 2 options at once, I split the 2 hooks.
- specified that both repos can be used at once

Co-authored-by: Sigurd Spieckermann <2206639+sisp@users.noreply.github.com>
  • Loading branch information
12rambau and sisp committed Jan 15, 2024
1 parent 1395040 commit ee5c106
Showing 1 changed file with 24 additions and 8 deletions.
32 changes: 24 additions & 8 deletions docs/updating.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,21 @@ setting you use.

## Preventing Commit of Merge Conflicts

If you use `--conflict rej` (the default):
If you use `--conflict inline` (the default) then you need to check for conflicts
markers in your files:

```yaml title=".pre-commit-config.yaml"
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
# Prevent committing inline conflict markers
- id: check-merge-conflict
args: [--assume-in-merge]
```

If you use `--conflict rej` then you need to review and remove all generated `.rej`
files:

```yaml title=".pre-commit-config.yaml"
repos:
Expand All @@ -70,17 +84,19 @@ repos:
# Prevent committing .rej files
- id: forbidden-files
name: forbidden files
entry: found Copier update rejection files; review them and remove them
description:
found Copier update rejection files; review and remove them before
merging.
language: fail
files: "\\.rej$"
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
# Prevent committing inline conflict markers
- id: check-merge-conflict
args: [--assume-in-merge]
```

!!! note

For projects that use both `rej` and `inline` depending on each user's preference,
you can add both hooks to your `pre-commit-config.yaml` file, making sure that no
unresolved merge conflicts are committed.

## Never change the answers file manually

!!! important
Expand Down

0 comments on commit ee5c106

Please sign in to comment.