Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add HUSKY_SKIP_HOOKS support #487

Closed
typicode opened this issue May 10, 2019 · 5 comments
Closed

feature: add HUSKY_SKIP_HOOKS support #487

typicode opened this issue May 10, 2019 · 5 comments

Comments

@typicode
Copy link
Owner

typicode commented May 10, 2019

When rebasing, it may be useful to be able to temporarily disable hooks. Unfortunately, it's not possible to do it with git rebase --no-verify, pre-commit hook is still run.

A test should be added in https://github.com/typicode/husky/blob/master/src/installer/getScript.ts#L54 to verify if HUSKY_SKIP_HOOKS is set to 1 or true, if that's the case the hook should display some message and exit.

$ HUSKY_SKIP_HOOKS=1 git rebase -i ...

Ideally a test could be added in https://github.com/typicode/husky/blob/master/.travis.yml to verify that hooks are skipped. Something like:

- HUSKY_SKIP_HOOK=1 time git checkout
# Check that no ci-post-checkout file was created via a ci-husky-skip-hooks.js script
# For example, see:
# https://github.com/typicode/husky/blob/master/scripts/ci-post-checkout-check.js

Related issues:
#468
#447

@asaf050
Copy link

asaf050 commented May 16, 2019

+1
Facing the same issue , unable to skip post-commit hook.

dnlup added a commit to dnlup/vue-cli-plugin-unit-ava that referenced this issue May 20, 2019
Disable prepare-commit-msg hook to avoid `standard-version` to hang. Waiting for this issue to be
closed typicode/husky#487.
@ozzywalsh
Copy link
Contributor

ozzywalsh commented May 23, 2019

Hi Guys,
I have created a pull request for this.
Feedback appreciated.

@typicode
Copy link
Owner Author

typicode commented Jun 5, 2019

Thanks again @ozzywalsh for the PR, it'll be released soon.

@davinanaya
Copy link

davinanaya commented Aug 1, 2019

Is there a way to run HUSKY_SKIP_HOOKS=1 in background when i run rebase ? is kind of tricky because if someone comes to a project and wants to make a rebase he dont know he needs to use HUSKY_SKIP_HOOKS. thanks

@qpxtWhite
Copy link

qpxtWhite commented Aug 6, 2019

@davinanaya I add some script to pre-commit hook

BRANCH_NAME=$(git branch | grep '*' | sed 's/* //')
if [[ $BRANCH_NAME =~ "no branch" ]]; then
  echo "You are rebasing, skipping hook"
  exit 0
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants