Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6390305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:30:37+00:00 2026-05-25T03:30:37+00:00

I’m looking at a Git hook which looks for print statements in Python code.

  • 0

I’m looking at a Git hook which looks for print statements in Python code. If a print statement is found, it prevents the Git commit.

I want to override this hook and I was told that there is a command to do so. I haven’t been able to find it. Any thoughts?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:30:38+00:00Added an answer on May 25, 2026 at 3:30 am

    Maybe (from git commit man page):

    git commit --no-verify -m "commit message"
               ^^^^^^^^^^^
    -n  
    --no-verify
    

    This option bypasses the pre-commit and commit-msg hooks. See also githooks(5).

    As commented by Blaise, -n can have a different role for certain commands.
    For instance, git push -n is actually a dry-run push.
    Only git push --no-verify would skip the hook.


    Note: Git 2.14.x/2.15 improves the --no-verify behavior:

    See commit 680ee55 (14 Aug 2017) by Kevin Willford (“).
    (Merged by Junio C Hamano — gitster — in commit c3e034f, 23 Aug 2017)

    commit: skip discarding the index if there is no pre-commit hook

    "git commit" used to discard the index and re-read from the filesystem
    just in case the pre-commit hook has updated it in the middle; this
    has been optimized out when we know we do not run the pre-commit hook.


    Davi Lima points out in the comments the git cherry-pick does not support –no-verify.
    So if a cherry-pick triggers a pre-commit hook, you might, as in this blog post, have to comment/disable somehow that hook in order for your git cherry-pick to proceed.

    The same process would be necessary in case of a git rebase --continue, after a merge conflict resolution.


    With Git 2.36 (Q2 2022), the callers of run_commit_hook() to learn if it got "success" because the hook succeeded or because there wasn’t any hook.

    See commit a8cc594 (fixed with commit 4369e3a1), commit 9f6e63b (07 Mar 2022) by Ævar Arnfjörð Bjarmason (avar).
    (Merged by Junio C Hamano — gitster — in commit 7431379, 16 Mar 2022)

    hooks: fix an obscure TOCTOU "did we just run a hook?" race

    Signed-off-by: Ævar Arnfjörð Bjarmason

    Fix a Time-of-check to time-of-use (TOCTOU) race in code added in 680ee55 ("commit: skip discarding the index if there is no pre-commit hook", 2017-08-14, Git v2.15.0-rc0 — merge listed in batch #3).

    This obscure race condition can occur if we e.g. ran the "pre-commit" hook and it modified the index, but hook_exists() returns false later on (e.g., because the hook itself went away, the directory became unreadable, etc.).
    Then we won’t call discard_cache() when we should have.

    The race condition itself probably doesn’t matter, and users would have been unlikely to run into it in practice.
    This problem has been noted on-list when 680ee55 was discussed, but had not been fixed.

    Let’s also change this for the push-to-checkout hook.
    Now instead of checking if the hook exists and either doing a push to checkout or a push to deploy we’ll always attempt a push to checkout.
    If the hook doesn’t exist we’ll fall back on push to deploy.
    The same behavior as before, without the TOCTOU race.
    See 0855331 ("receive-pack: support push-to-checkout hook", 2014-12-01, Git v2.4.0-rc0 — merge) for the introduction of the previous behavior.

    This leaves uses of hook_exists() in two places that matter.
    The "reference-transaction" check in refs.c, see 6754159 ("refs: implement reference transaction hook", 2020-06-19, Git v2.28.0-rc0 — merge listed in batch #7), and the "prepare-commit-msg" hook, see 66618a5 ("sequencer: run ‘prepare-commit-msg’ hook", 2018-01-24, Git v2.17.0-rc0 — merge listed in batch #2).

    In both of those cases we’re saving ourselves CPU time by not preparing data for the hook that we’ll then do nothing with if we don’t have the hook.
    So using this "invoked_hook" pattern doesn’t make sense in those cases.

    The "reference-transaction" and "prepare-commit-msg" hook also aren’t racy.
    In those cases we’ll skip the hook runs if we race with a new hook being added, whereas in the TOCTOU races being fixed here we were incorrectly skipping the required post-hook logic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.