How to bypass Git Hooks
Temporarily skip your CI checks
git push --no-verify is a command used to push your local changes to a remote repository without running pre-commit hooks or pre-push hooks. Pre-commit hooks and pre-push hooks are scripts that run before a commit or a push, and they are used to perform automated tests, code quality checks, or other actions that help ensure the quality and correctness of your code. You can use husky or pre-commit if you need extra features or just production ready tools.
Sometimes, you may need to bypass these hooks and push your changes without running them. For example, if you’re in a hurry and you need to push a critical bug fix, or if you’re working in a team with strict code review policies and you need to push a work-in-progress commit for collaboration purposes.
To use it simply add the
--no-verify flag to your git push command:
git push --no-verify
This will push your changes to the remote repository without running the pre-commit or pre-push hooks.
However, it’s important to note that using –no-verify should be done with caution, as it can potentially lead to lower code quality and a higher risk of introducing bugs or other issues into your codebase. Therefore, it’s recommended to only use –no-verify when it’s absolutely necessary and always double-check your code before pushing it to a remote repository.
You can check the official Git Documentation.
If you want a refresher on general Git practices you can check my presentation.