Commit-hooks: bypass when squashing

Marcel van Pinxteren 3 months ago updated 3 months ago 1

When doing a regular commit, there is a checkbox "Bypass commit hook".  

When re-organizing commits, i.e. dragging and/or squashing, there is no such option.

I'm not convinced whether it is the best thing to pollute each command that somehow commits with such a low-level option. Maybe we should add it to the repository settings?

In my personal use case, I want to switch off commit hooks only temporarily, for all commands.

I agree that you don't want to pollute the UI. I don't have a clear solution for this now.

You could follow the pattern of Windows' way of temporarily disabling the virus scanner. It switches back on automatically after, say 15 minutes.

In my use case, I have a pre-commit hook that lints my Typescript code. If it fails, the commit fails. Another solution would be to allow the commit/squash process to continue, even with a failing commit hook. Maybe just a notification with the option to cancel or continue?