typicode / husky

Git hooks made easy 🐶 woof!
https://typicode.github.io/husky
MIT License
32.33k stars 1.02k forks source link

Interactive rebase #447

Closed rkulinski closed 5 years ago

rkulinski commented 5 years ago

When I run: git rebase -i HEAD~3 pre-commit hook is ran for every commit.

Is it possible (no docs about it) to skip pre-commit hook for interactive rebase? --no-verify didn't seem to work.

My config in package.json

  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "*.{ts,html,scss}": [
      "yarn pretty",
      "git add"
    ]
  },
christopher-francisco commented 5 years ago

I was blocked for an hour. Seems like there isn't?

reword a1b2c3 Introduce a linting bug
fixup d4e5f6 Fix the linting bug

There is no way to rebase -i the history above. I had to rm -f .git/hooks/*

rkulinski commented 5 years ago

I don't understand.

christopher-francisco commented 5 years ago

@rkulinski what do you mean?

--no-verify doesn't work when doing an interactive rebase, which commits code

aburkowsky9 commented 5 years ago

Is there any update on this issue. I'm seeing the same thing.

michaellarocca90 commented 5 years ago

Me as well... any traction on this or workarounds?

typicode commented 5 years ago

Happy to announce that in v2.4.0, you can now do HUSKY_SKIP_HOOKS=1 git rebase ... and it will skip all hooks.

davidmaxwaterman commented 3 years ago

Doesn't seem to work any more:

$ HUSKY_SKIP_HOOKS=1 git rebase --no-verify -i 3cba9e256342f9fe47d7a34d66469611ef3c8da8 
Rebasing (1/9)
> <snip> precommit
> npm run prettier:check && npm run lint && npm run build && npm test && npm run rollup

> <snip> prettier:check
> prettier "./src/**/*.ts" --check

Checking formatting...
[warn] <snip>
[warn] <snip>
[warn] Code style issues found in the above file(s). Forgot to run Prettier?
husky - pre-commit hook exited with code 1 (error)
You can amend the commit now, with

  git commit --amend 

Once you are satisfied with your changes, run

  git rebase --continue
$ npm ls | grep husky
├── husky@6.0.0

Anyone any clues what I'm missing?

ghost commented 3 years ago

@davidmaxwaterman Please, consider reading the docs before asking, as you can see, this thread is 3 years old now, a ton of things changed since v2.4.0 (we're on 7.0.1)

i suppose you're using one of the most recent verions of husky, the new environment variable for skipping hooks is HUSKY, so you can achieve the same behavior by running:

$ HUSKY=0 git rebase -i <commit_hash>
davidmaxwaterman commented 3 years ago

Thanks. I ended up using the --no-verify option on the .

i suppose you're using one of the most recent verions of husky,

Please consider reading what I wrote...it's clear what version I am using :p Anyway, thanks for linking to the docs - so that others who come here don't have to trawl through the docs just to be able to do basic git commands. Perhaps it's a good idea to add something like this to the FAQ. Also, I wouldn't have necessarily recognised 'BYPASS HOOKS' as a verb, so much as a noun....'BYPASSING HOOKS' might be better. With those comments in mind, I went ahead and made a pull request: https://github.com/typicode/husky/pull/1024