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
🌐
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?

🌐
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.
🌐
Andrew Wheeler
andrewpwheeler.com › 2021 › 11 › 11 › pre-commit-hooks-and-github-actions
pre-commit hooks and github actions | Andrew Wheeler
November 11, 2021 - I think it is good to do some googling ... The idea behind pre-commit, is that it runs a set of commands to check your py files before you commit your changes to github on your local system....
Find elsewhere
🌐
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
🌐
Medium
gatlenculp.medium.com › effortless-code-quality-the-ultimate-pre-commit-hooks-guide-for-2025-57ca501d9835
Effortless Code Quality: The Ultimate Pre-Commit Hooks Guide for 2025
February 9, 2025 - Pre-commit hooks are collection of hooks managed by the pre-commit team. These hooks help maintain repository hygiene by preventing common file-related issues: check-case-conflict - Prevents issues on case-insensitive filesystems (Windows/MacOS) ...
🌐
bluebirz
bluebirz.net › posts › try-pre-commit
Let's try: pre-commit before you commit | bluebirz
September 18, 2025 - This repo also includes .pre-commit-config.yaml in some applications. GitHub - bluebirz/sample-pre-commit: Sample repo for pre-commit
🌐
DEV Community
dev.to › angu10 › setting-up-pre-commit-hooks-in-github-ensuring-code-quality-and-consistency-289n
Setting Up Pre-Commit Hooks in GitHub: Ensuring Code Quality and Consistency - DEV Community
September 28, 2023 - In the .pre-commit-config.yaml file, define the hooks you want to use. For example, to use the Black code formatter: repos: - repo: https://github.com/psf/black rev: <version> hooks: - id: black
🌐
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.
🌐
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%