You should be using them both. Run pre-commit locally to run checks before committing to your local GitHub repository. Then run GitHub actions when you push and/or create a pull request to the remote repository on GitHub. I use tox to build Python projects with GitHub actions so that the entire build process can be checked across platforms. pre-commit doesn’t do that for me but it still does a lot to my code beforehand so this is why I use both. If the project builds successfully with GitHub actions using tox and all tests pass then I allow the pull request to be approved for merging. If anything fails it’s time to refactor the code and resubmit. Answer from Deleted User on reddit.com
GitHub
github.com › pre-commit › pre-commit
GitHub - pre-commit/pre-commit: A framework for managing and maintaining multi-language pre-commit hooks. · GitHub
A framework for managing and maintaining multi-language pre-commit hooks. - pre-commit/pre-commit
Starred by 15.2K users
Forked by 961 users
Languages Python 97.4% | R 2.0% | Shell 0.5% | Dockerfile 0.1% | Lua 0.0% | Ruby 0.0%
pre-commit
pre-commit.com
pre-commit
For each language, they default to using the system installed language (So for example if I’m running python3.7 and a hook specifies python, pre-commit will run the hook using python3.7). Sometimes you don’t want the default system installed version so you can override this on a per-hook basis by setting the language_version. - repo: https://github.com/pre-commit/mirrors-scss-lint rev: v0.54.0 hooks: - id: scss-lint language_version: 2.1.5
Videos
29:33
Complete guide to GitHooks - Creating your own pre-commit hooks ...
10:38
Boost Your Git Workflow with Pre-Commit Hooks | Wahl Network - YouTube
15:16
Boost Your Coding Efficiency with Git Pre-Commit Hooks - YouTube
29:19
Pre Commit Hooks EXPLAINED | Easy Way Clean Repo! GitHub & PyCharm ...
06:51
Git Pre-commit Hooks: Boost Code Quality & Consistency! 🚀 - YouTube
Reddit
reddit.com › r/python › when to use pre-commit hook vs github actions?
r/Python on Reddit: When to use pre-commit hook vs GitHub actions?
October 26, 2023 -
Hello! I’m working on a personal project and want to include features such as mypy, ruff, and auto runs of tests. As far as testing I’ve seen some cool integrations with GitHub actions. For ruff and mypy I’ve seen it go both ways in a pre-commit hook or in actions. Is there a standard for where ruff or mypy should be used?
Top answer 1 of 11
62
You should be using them both. Run pre-commit locally to run checks before committing to your local GitHub repository. Then run GitHub actions when you push and/or create a pull request to the remote repository on GitHub. I use tox to build Python projects with GitHub actions so that the entire build process can be checked across platforms. pre-commit doesn’t do that for me but it still does a lot to my code beforehand so this is why I use both. If the project builds successfully with GitHub actions using tox and all tests pass then I allow the pull request to be approved for merging. If anything fails it’s time to refactor the code and resubmit.
2 of 11
34
i used to not love pre commit hooks but i've changed my mind assuming they're done right. i'd probably set all my future projects up this way the workflow that changed my mind is this: is configured with pre-commit locally, only runs the checks on the files changed during your commit. runs pretty much instantly in GitHub, runs the checks on all files as its own job really doesn't get in the way of anything makes me waste way less time to find out about silly mistakes consistent between local/ci envs
DEV Community
dev.to › afl_ext › are-pre-commit-git-hooks-a-good-idea-i-dont-think-so-38j6
Are pre-commit git hooks a good idea? I don't think so. - DEV Community
December 17, 2023 - This point is stupid because you will squash pull requests anyway so any weird commits not passing tests are removed. Fair point, you will save some time, but are you really that tight on budget that you can't spare some seconds? If this is a problem, maybe your pipelines can be configured better. Follow the fail-early method, run linter first, then units, then integration, and so on. Ultimately, the developer working time is much more expensive, and with pre-commit hooks you lose a bit of this time.
Git
git-scm.com › book › en › v2 › Customizing-Git-Git-Hooks
Git - Git Hooks
The pre-commit hook is run first, before you even type in a commit message. It’s used to inspect the snapshot that’s about to be committed, to see if you’ve forgotten something, to make sure tests run, or to examine whatever you need to inspect in the code.
Stefanie Molin
stefaniemolin.com › articles › devx › pre-commit › setup-guide
How to Set Up Pre-Commit Hooks | Stefanie Molin
December 7, 2025 - Next, we need to create a configuration file called .pre-commit-config.yaml. This file specifies which hooks to run and how to run them. Here’s a minimal configuration to get you started: repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.5.0 # the release, git tag, or commit you want to use hooks: - id: check-toml - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace
GitHub
github.com › pre-commit › pre-commit-hooks
GitHub - pre-commit/pre-commit-hooks: Some out-of-the-box hooks for pre-commit · GitHub
- repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 # Use the ref you want to point at hooks: - id: trailing-whitespace # - id: ...
Starred by 6.5K users
Forked by 789 users
Languages Python
GitKraken
help.gitkraken.com › gitkraken-client › githooksexample
Pre-Commit Hook Example in GitKraken Client | Git Hooks Example
June 28, 2024 - The hook is useful so that the commits contain the correct committer email address and also to ensure the commits are signed. First navigate to the hooks directory for the target repo. Open a Visual Studio Code window and navigate to repo .git hooks. From here, add a new file to the .git/hooks directory called pre-commit.
Databricks Community
community.databricks.com › t5 › data-engineering › how-to-add-pre-commit-hook-to-the-git-client-on-databricks › td-p › 4859
Solved: How to add pre-commit hook to the Git Client on Da... - Databricks Community - 4859
May 19, 2023 - Solved: I'd like to add a Git pre-commit hook to the Databricks Cluster. This pre-commit hook should be executed when pushing to GitHub. - 4859
Hotosm
docs.hotosm.org › dev-guide › repo-management › pre-commit
Pre-Commit - HOTOSM Docs
- repo: https://github.com/pyc... CHANGELOG.md, --ignore, .github] Note: the config above is for a monorepo configuration. Your repo may not require both Python and JS code formatting. ... # Standard install for most hooks pre-commit install # Additional commit-msg hook ...
Pre-commit
pre-commit.ci
pre-commit.ci
Developers spend a fair chunk of time during their development flow on fixing relatively trivial problems in their code. pre-commit.ci both enforces that these issues are discovered (which is opt-in for each developer's workflow via pre-commit) but also fixes the issues automatically, letting developers focus their time on more valuable problems. Sign In With GitHub
GitHub
github.com › desktop › desktop › issues › 5036
Failed to locate pre-commit hook · Issue #5036 · desktop/desktop
June 26, 2018 - Install precommit (https://github.com/observing/pre-commit) Add · "precommit": { "run": "tslint" }, to package.json · And commit anything, you will see that error. I found this issue in dugite desktop/dugite#96 And the latest version of Githubdesktop use ASAR file as well, so there might have some connection.
Author JoeyLi-1
GitHub
github.com › cachix › git-hooks.nix
GitHub - cachix/git-hooks.nix: Seamless integration of https://pre-commit.com git hooks with Nix. · GitHub
Pre-commit >= 4.4.0 renamed "system" to "unsupported". This does not mean deprecated — "unsupported" is just a new name to reflect that when using this language, pre-commit does not provision the tools, and using externally managed tools (e.g.
Starred by 792 users
Forked by 222 users
Languages Nix
Atlassian
atlassian.com › git › tutorials › git-hooks
Git Hooks | Atlassian Git Tutorial
December 16, 2025 - The pre-commit script is executed every time you run git commit before Git asks the developer for a commit message or generates a commit object. You can use this hook to inspect the snapshot that is about to be committed.
GitHub
github.com › j178 › prek
GitHub - j178/prek: ⚡ A fast Git hook manager written in Rust, designed as a drop-in alternative to pre-commit, reimagined.
3 weeks ago - ⚡ A fast Git hook manager written in Rust, designed as a drop-in alternative to pre-commit, reimagined. - j178/prek
Starred by 7.6K users
Forked by 210 users
Languages Rust 97.4% | Python 1.7%
GitHub
github.com › lorenzwalthert › precommit
GitHub - lorenzwalthert/precommit: pre-commit hooks for R projects
pre-commit hooks for R projects. Contribute to lorenzwalthert/precommit development by creating an account on GitHub.
Starred by 276 users
Forked by 50 users
Languages R 99.8% | R 99.8%