I have a range of commits that fail the tests that are committed with them. I need to interactive-rebase across these commits; but the hooks are failing, and causing each commit to screw up, forcing me to manually git commit -n each step.

Is there a way to automate this? git rebase --interactive --no-verify doesn't do what I'd expect.

  • 1
    have you found a solution to this problem? Sep 19, 2018 at 15:56

2 Answers 2


I stumbled upon the same problem, but the only answer I found required modifying the hook itself.

Here the author suggests filtering this situation using the branch name:

BRANCH_NAME=$(git branch | grep '*' | sed 's/* //') 

if [[ $BRANCH_NAME != *"no branch"* ]]
  # your regularly scheduled hook

I changed the condition a little bit, as my git output looks like (no branch, rebasing some-branch-name). It does not solve my specific case, but maybe someone will find this question and use this approach in future.

  • 1
    that's pretty neat! perhaps REBASING=$(git branch | grep '\* (no branch') would be already enough for checking on the if statement as if [ -z "$REBASING" ] ...
    – zanona
    Nov 26, 2020 at 9:34

I like this solution from https://blog.swwomm.com/2018/06/skip-pre-commit-hook-on-git-rebase-or.html:

Add this to the pre-commit hook script:

if [ "$NO_VERIFY" ]; then
    echo 'pre-commit hook skipped' 1>&2
    exit 0

and then do this before and after running the interactive rebase:

export NO_VERIFY=1
git rebase -i master # or `git merge some-branch` or whatever
export NO_VERIFY=

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.