Last active
January 5, 2023 01:28
-
-
Save PrettySolution/ba76733e0d963481130806433b07eaf1 to your computer and use it in GitHub Desktop.
install Husky and commitizen in non NPM projects zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# how to install Husky and commitizen on non NPM projects (zsh + iTerm2) | |
# install Husky on each opening if folder is a git repository | |
echo '[ -d .git ] && npx husky install > /dev/null || true' >> ~/.zshrc | |
# set commitizen to intercept 'git commit -m' | |
mkdir -p ~/.git-templates/hooks/ | |
echo '#!/bin/bash' > ~/.git-templates/hooks/prepare-commit-msg | |
echo 'exec < /dev/tty && npx cz --hook || true' >> ~/.git-templates/hooks/prepare-commit-msg | |
# testing | |
git clone git@gitlab.com:UnderDefense/product-soar/api.git | |
cd api | |
touch test-file.py | |
git add . | |
git commit -m 'non conventional message' | |
conventional message | |
# the message was 'fix: conventional message' | |
# _ _ __ | |
# _ _ _ __ __| | ___ _ __ __| | ___ / _| ___ _ __ ___ ___ | |
#| | | | '_ \ / _` |/ _ \ '__/ _` |/ _ \ |_ / _ \ '_ \/ __|/ _ \ | |
#| |_| | | | | (_| | __/ | | (_| | __/ _| __/ | | \__ \ __/ | |
# \__,_|_| |_|\__,_|\___|_| \__,_|\___|_| \___|_| |_|___/\___| | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment