mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-04-05 19:46:54 +00:00
Auto-detect repository's default branch instead of hard-coding list
This commit is contained in:
parent
f1dff44d3a
commit
ea5f72dd61
3 changed files with 48 additions and 2 deletions
|
|
@ -152,7 +152,9 @@ verifies that test files are named correctly.
|
|||
#### `no-commit-to-branch`
|
||||
Protect specific branches from direct checkins.
|
||||
- Use `args: [--branch, staging, --branch, main]` to set the branch.
|
||||
Both `main` and `master` are protected by default if no branch argument is set.
|
||||
If no branch argument is set, the hook auto-detects the repository's default
|
||||
branch from `origin/HEAD`. Falls back to protecting both `main` and `master`
|
||||
if `origin/HEAD` is not configured.
|
||||
- `-b` / `--branch` may be specified multiple times to protect multiple
|
||||
branches.
|
||||
- `-p` / `--pattern` can be used to protect branches that match a supplied regex
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue