Files
30-seconds-of-code/snippets/commit-without-hooks.md
2022-03-22 12:02:38 +02:00

24 lines
611 B
Markdown

---
title: Commit without running git hooks
tags: commit
expertise: intermediate
author: maciv
firstSeen: 2021-04-04T20:55:26+03:00
lastUpdated: 2021-04-13T21:10:59+03:00
---
Creates a new commit skipping the pre-commit and commit-msg hooks.
- Use `git commit --no-verify -m <message>` to commit staged changes without running git hooks.
```shell
git commit --no-verify -m <message>
```
```shell
# Make some changes to files, ones that your precommit hook might not allow
git add .
git commit --no-verify -m "Unsafe commit"
# Creates a commit with the message "Unsafe commit", without running git hooks
```