Skip to content

Config with prepare-commit-msg blocks squashing via interactive rebase #669

@kceb

Description

@kceb

Hello, first off thanks for making this wonderful library.

I'm currently using husky to enforce commitizen on every commit. It's been working fine, however, there are times when I need to manually squash certain commits. To do this, I use an interactive rebase (ex: git rebase -i HEAD~4). Whenever I do this it gets stuck and the rebase has to abort.

I've tried the following solution:

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

if [ $BRANCH_NAME != '(no branch)' ]
then
  exec < /dev/tty && git-cz --hook || true
fi

However, it doesn't work, I presume, when in the squashing step. It just freezes.

I've also had trouble running yarn version --no-commit-hooks and yarn config set version-commit-hooks false, which also freezes

Any idea on how to get around this?

Update: for husky v2.4.0 and above, it seems like you can use HUSKY_SKIP_HOOKS=1 git rebase .... I'll go this route for now, however, I'll leave the issue open in case there's a better alternative for those not using husky

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions