Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk4 min

How to Fix Slow Git Commits Caused by Pre-Commit Hooks

A slow commit may be waiting on a hook, not Git. Find the hook path, isolate the expensive check, and reduce unnecessary work without disabling safeguards.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

If git commit pauses before creating a commit, check the hook Git actually runs before blaming Git itself. Find the hook path, separate one-time environment setup from recurring work, then run hooks individually and narrow their file scope. This guide focuses on Git’s pre-commit hook and the pre-commit framework.

Why are my Git commits so slow?

Git runs the pre-commit hook before it obtains the proposed commit message and writes the commit. A hook that fails can stop the commit entirely. The hook may launch pre-commit, a wrapper, or project-specific commands, so the delay may come from any of those steps—not Git’s commit operation itself. See the Git githooks documentation.

Find the hook Git actually launches

Git normally looks for hooks in $GIT_DIR/hooks. The core.hooksPath setting can redirect it to another directory. In a non-bare repository, Git runs hooks from the working tree’s root.

  1. Check whether a custom hook directory is configured:

    Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
    #1 Best Overall
    Amazon Basics Wired QWERTY Keyboard, Works with Windows, Plug and Play, Easy to Use with Media Control, Full-Sized, Black
    • KEYBOARD: The keyboard works for Windows with hot keys that enable easy access to Media, My Computer, Mute, Volume up/down, and Calculator
    • EASY SETUP: Experience simple installation with the USB wired connection
    • VERSATILE COMPATIBILITY: This keyboard is designed to work with multiple Windows versions, including Vista, 7, 8, 10 offering broad compatibility across devices.
    • SLEEK DESIGN: The elegant black color of the wired keyboard complements your tech and decor, adding a stylish and cohesive look to any setup without sacrificing function.
    • FULL-SIZED CONVENIENCE: The standard QWERTY layout of this keyboard set offers a familiar typing experience, ideal for both professional tasks and personal use.
    git config --show-origin --get core.hooksPath

    If the command prints a path, inspect that directory. If it prints nothing, check the repository’s Git directory, usually the hooks subdirectory under .git.

  2. Read the installed pre-commit hook script. Follow any wrapper or shell commands it calls until you can identify the actual tools and project scripts being run.

A script named pre-commit is only the entry point; its contents determine what is executed. The Git hooks reference describes hook locations and when the pre-commit hook runs.

Rank #2
Sale
Logitech MK270 Full Size Wireless Keyboard and Mouse Combo - Black
  • Reliable Plug and Play: The USB receiver provides a reliable wireless connection up to 33 ft (1), so you can forget about drop-outs and delays and you can take it wherever you use your computer
  • Type in Comfort: The design of this keyboard creates a comfortable typing experience thanks to the low-profile, quiet keys and standard layout with full-size F-keys, number pad, and arrow keys
  • Durable and Resilient: This full-size wireless keyboard features a spill-resistant design (2), durable keys and sturdy tilt legs with adjustable height
  • Long Battery Life: MK270 combo features a 36-month keyboard and 12-month mouse battery life (3), along with on/off switches allowing you to go months without the hassle of changing batteries
  • Easy to Use: This wireless keyboard and mouse combo features 8 multimedia hotkeys for instant access to the Internet, email, play/pause, and volume so you can easily check out your favorite sites

Determine whether the delay is setup or recurring work

On its first run, pre-commit may download and install a hook environment, including a language runtime. Its documentation says those environments are reused on later runs. If the delay happened on the first run after installing or changing hooks, initialization may explain it; if the same hooks have run successfully before and commits remain slow, look for recurring work in their commands.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To provision missing environments ahead of a commit, run either:

pre-commit install --install-hooks

or:

pre-commit install-hooks

The pre-commit documentation does not specify a universal runtime or speed threshold, so compare the behavior of your own hooks rather than treating a particular duration as abnormal. See pre-commit’s installation and usage documentation.

Rank #3
Sale
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
  • All-day Comfort: The design of this standard keyboard creates a comfortable typing experience thanks to the deep-profile keys and full-size standard layout with F-keys and number pad
  • Easy to Set-up and Use: Set-up couldn't be easier, you simply plug in this corded keyboard via USB on your desktop or laptop and start using right away without any software installation
  • Compatibility: This full-size keyboard is compatible with Windows 7, 8, 10 or later, plus it's a reliable and durable partner for your desk at home, or at work
  • Spill-proof: This durable keyboard features a spill-resistant design (1), anti-fade keys and sturdy tilt legs with adjustable height, meaning this keyboard is built to last
  • Plastic parts in K120 include 51% certified post-consumer recycled plastic*

Isolate the hook that takes time

Run a configured hook by its ID to focus on that check and show output even if it succeeds:

pre-commit run <hook_id> --verbose

Repeat for the hook IDs in your configuration, then inspect the slow hook’s executable, arguments, environment, and any project scripts it invokes. This is a way to narrow the culprit, not a benchmark or a guarantee of detailed profiling; profiling further depends on the tool the hook runs.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check how many files each hook examines

A normal Git-triggered pre-commit run generally checks staged files. By contrast, pre-commit run --all-files intentionally checks the repository’s files, which can mean substantially more work. Confirm that a hook or wrapper is not calling an all-files command when you expect a staged-file check.

Rank #4
Redragon K521 Upgrade Rainbow LED Gaming Keyboard, 104 Keys Wired Mechanical Feeling Keyboard with Multimedia Keys, One-Touch Backlit, Anti-Ghosting, Compatible with PC, Mac, PS4/5, Xbox
  • 【Dreamy Rainbow Gaming Keyboard】K521 Gaming Keyboard Adopts a Different LED Backlight Design, Upgraded on the Traditional LED Backlight Effect, Making the Light More Penetrating, Giving You a More Dazzling Visual Effect, Making Your Gaming Process More Enjoyable
  • 【One Touch Opens & Visual Feast】The K521 Red Dragon Keyboard has a One-Touch on/off Lighting Button for Added Convenience. It also has a Three-Position Adjustable Breathing Mode and a Four-Position Adjustable Brightness Lighting Mode
  • 【Mechanical Feeling & Fast Tapping】The PC Keyboard Keys are Designed for Mechanical Feeling, Giving You a Better Feel During Use and the Ability to Trigger Keys Quickly, Allowing You to Win All Your Games
  • 【19 Keys Anti-Ghosting Keyboard】Anti-Ghosting Ensures Every Button Can Be Triggered. This Allows You to Trigger Key Combinations In The Game Accurately, And Each Skill Can Be Accurately Released to Increase Your Winning Rate. Redragon K521 Will Be Your Perfect Partner
  • 【12 Multimedia Combination Keys】The K521 Wired Gaming Keyboard is Equipped with 12 Multimedia Keys That Can Greatly Enhance Your Gaming/Office Efficiency and Make It More Convenient to Use

In .pre-commit-config.yaml, inspect each slow hook’s matching rules and execution settings:

  • files and exclude determine which paths match or are omitted.
  • types, types_or, and exclude_types refine matching by file type.
  • always_run can invoke a hook even when no matching files are staged.

Adjust filters only when they accurately reflect what the check needs to inspect. For example, excluding irrelevant generated files can reduce needless work, but filtering out files that require validation weakens coverage.

The fail_fast option stops later checks after the first failure. It can avoid running later hooks during a failing run, but it does not inherently make a successful run faster. Hooks also support stages; a check that need not run on every commit can be assigned to another supported stage or run manually, if that fits the project’s workflow. See the pre-commit configuration documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Logitech K270 Full Size Wireless Keyboard for Windows - Black
  • All-day Comfort: This USB keyboard creates a comfortable and familiar typing experience thanks to the deep-profile keys and standard full-size layout with all F-keys, number pad and arrow keys
  • Built to Last: The spill-proof (2) design and durable print characters keep you on track for years to come despite any on-the-job mishaps; it’s a reliable partner for your desk at home, or at work
  • Long-lasting Battery Life: A 24-month battery life (4) means you can go for 2 years without the hassle of changing batteries of your wireless full-size keyboard
  • Simply plug the USB receiver into a USB port on your desktop, laptop or netbook computer and start using the keyboard right away without any software installation
  • Simply Wireless: Forget about drop-outs and delays thanks to a strong, reliable wireless connection with up to 33 ft range (5); K270 is compatible with Windows 7, 8, 10 or later
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Verify that the pre-commit environment is reusable

By default, pre-commit stores its hook environments in ~/.cache/pre-commit. PRE_COMMIT_HOME overrides that location; otherwise, XDG_CACHE_HOME sets the base directory used for the pre-commit store. Check that the environment in which you commit can access the expected store consistently—for example, if commits run inside a container or another isolated environment.

The documented cache paths are not a reason to delete the cache routinely. Clearing it can require environments to be installed again; consider it only when you have a specific cache problem to resolve. See pre-commit’s cache documentation.

Use a bypass only to test a diagnosis or handle an exception

If you have identified one slow pre-commit hook, skip just that hook for a controlled diagnostic or exceptional commit:

SKIP=<hook_id> git commit -m "message"

This helps confirm whether that hook accounts for the pause. Git also supports git commit --no-verify, which bypasses the pre-commit hook more broadly. Both choices temporarily remove local checks; use the result to fix the hook’s scope or workflow rather than leaving the bypass in place. Git documents --no-verify in its pre-commit hook reference, and pre-commit documents selective skipping at pre-commit.com.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Decide whether a check belongs in CI

Local hooks provide feedback before the commit is created and can check staged changes. CI can run checks after a push and may check changed files or a broader scope. The right split depends on how quickly the check needs to inform the developer, how much code it must cover, whether it can modify files, and whether developers need to work offline.

For a changed-file CI run, pre-commit documents:

pre-commit run --from-ref <base> --to-ref <head>

It also documents running checks across all files in CI and describes pre-commit.ci, which can autofix pull requests and periodically update hook configuration. These are workflow options, not promises of a particular reduction in local commit time. Keep quick, high-value checks local when immediate feedback matters; consider CI for checks whose cost or scope makes them unsuitable for every commit.

Quick Recap

Bestseller No. 1
SaleBestseller No. 3
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Logitech K120 Full Size Wired Keyboard USB Plug-and-Play Windows - Black
Plastic parts in K120 include 51% certified post-consumer recycled plastic*; Product carbon footprint: 4.02 kg CO2e
$12.34
SaleBestseller No. 5
Logitech K270 Full Size Wireless Keyboard for Windows - Black
Logitech K270 Full Size Wireless Keyboard for Windows - Black
Plastic parts in K270 include 38% certified post-consumer recycled plastic; Eight hot keys: For instant access to the Internet, e-mail, music volume and more
$21.48

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.