0

I have git hooks defined in package.json for pre-commit and I just added one for pre-rebase. The problem is that I do not want the pre-rebase hook to execute on a git pull which happens right now due to the flow. I tried searching how I could prevent it but was unsuccessful and thought of adding one more git hook for git pull which might just prevent the pre rebase hook in package.json but could not find any documentation on how to do it. Can someone point me how to go about it?

script snippet of package.json

"scripts": {
    "precommit": "lint-staged && npm test",
    "prerebase": "lint-staged && npm test",
    "test": "grunt unit-test"
  },
phantomsays
  • 187
  • 2
  • 11
  • git rebase supports --no-verify, but git pull does not pass any arguments to git rebase. What's your motivation? – Josh Lee Apr 27 '18 at 18:25
  • @JoshLee: I want to ensure code is commented properly and tests are run before every commit. I also would need this same thing when I resolve any conflicts after committing and pulling code and then doing a rebase --continue. That was my intention to add a git hook for prerebase. But this hook would execute twice, once during rebase and then pull and I do not want the hook to run during a pull. So I wanted a way when it can skip the rebase hook from being executed when a pull happens. – phantomsays Apr 27 '18 at 19:47

0 Answers0