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.3K users
Forked by 974 users
Languages   Python 97.4% | R 2.0% | Shell 0.5% | Dockerfile 0.1% | Lua 0.0% | Ruby 0.0%
🌐
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?

Discussions

How can I make a Git pre-commit code check? - Stack Overflow
Is it even possible to accomplish this with Git? :) I want this: Sometimes I switch one variable in my code to true (localMode = true;) for my own debugging purposes. But this should never be commi... More on stackoverflow.com
🌐 stackoverflow.com
Failed to locate pre-commit hook
Description The latest version popup error when I try to commit code. This works fine before I upgraded to the latest version. Version GitHub Desktop: 1.2.6 Operating system: Win10 Steps to Reprodu... More on github.com
🌐 github.com
14
June 26, 2018
Arguments for and against pre-commit hooks?
I'm not a fan of pre-commit hooks, as they slow me down and discourage me from making frequent, small commits. They also don't prevent code from being merged, as you can always skip them locally. Instead, I prefer integrating the tooling (like linting) directly with the IDE which gives me feedback right when typing, not when I want to commit, combined with PR checks which then actually prevent these problems from being merged in. More on reddit.com
🌐 r/git
18
7
September 16, 2023
Git pre-commit hook to ensure code documentation
I think it may seem reasonable at first (to have all functions documented) but could detrimental in the long run. Do really ALL functions be documented? Even smallest internal ones? What if somebody is writing some unstable code (unstable = to be changed soon)? E.g. if somebody makes bigger refactoring and changes/create multiple functions at once? (half of them will be probably removed in the coming days because they will be subject to further refactoring). Writing docs for such functions is just waste of time. I think self-discipline and code review would be better solution to ensure good amount (and quality!) of docs than a pre-commit hook. More on reddit.com
🌐 r/javascript
23
16
August 24, 2018
🌐
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
🌐
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
🌐
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.6K users
Forked by 787 users
Languages   Python
🌐
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
🌐
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 - 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
supported hosting platforms: currently only GitHub is supported, more to come in the future! configuration: zero configuration setup -- nothing is needed beyond the .pre-commit-config.yaml file you already have!
🌐
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   desktop
🌐
GitHub
github.com › cachix › git-hooks.nix
GitHub - cachix/git-hooks.nix: Seamless integration of https://pre-commit.com git hooks with Nix. · GitHub
Run $ nix-build -A pre-commit-check to perform the checks as a Nix derivation. Integrate hooks to prepare environment as part of shell.nix:
Starred by 829 users
Forked by 226 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.
April 15, 2026 - ⚡ A fast Git hook manager written in Rust, designed as a drop-in alternative to pre-commit, reimagined. - j178/prek
Starred by 7.8K users
Forked by 217 users
Languages   Rust 97.6% | Python 1.6%