How can I prevent interactive-rebase from running verification hooks on commits?

12

2

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.

ELLIOTTCABLE

Posted 2017-06-28T11:03:47.263

Reputation: 1 207

1have you found a solution to this problem? – David Schumann – 2018-09-19T15:56:46.857

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:

#!/bin/bash
BRANCH_NAME=$(git branch | grep '*' | sed 's/* //') 

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

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.

Piotr Zierhoffer

Posted 2017-06-28T11:03:47.263

Reputation: 173