Last active
March 10, 2019 09:57
-
-
Save enis-ismail/dbc154f927853a37218860100a64eaf1 to your computer and use it in GitHub Desktop.
Git hooks: pre-commit
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
#!/bin/bash | |
# Instructions to make hooks executable: | |
#- for Windows (attrib +x pre-commit) | |
#- for Linux (chmod +x pre-commit) | |
# ---------------------------------------------------------- # | |
# Prevent committing changes for files from specific folders # | |
# ---------------------------------------------------------- # | |
for SRC_PATTERN in "app_storefront_base" "modules"; do | |
if git diff --cached --name-only | grep --quiet "$SRC_PATTERN/"; then | |
echo "Changes in $SRC_PATTERN cartridge are not allowed. If you want to skip the pre-commit hook just add --no-verify: git commit --no-verify" | |
exit 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment