Skip to content

Instantly share code, notes, and snippets.

View kristijan-pajtasev's full-sized avatar
🇭🇷

Kristijan kristijan-pajtasev

🇭🇷
View GitHub Profile
@kristijan-pajtasev
kristijan-pajtasev / .huskyrc
Created September 12, 2019 22:42
Husky configuration file example for pre-commit hook
// .huskyrc
{
"hooks": {
"pre-commit": "echo \"Hello, pre-commit hook!\""
}
}
@kristijan-pajtasev
kristijan-pajtasev / script.sh
Last active September 12, 2019 22:41
Prevent commit to master
#!/bin/sh
branch="$(git rev-parse - abbrev-ref HEAD)"
# a branch name where you want to prevent git push. In this case, it's "master"
if [ "$branch" = "master" ]; then
echo "You can't commit directly to '"${branch}"' branch"
exit 1
fi
@kristijan-pajtasev
kristijan-pajtasev / Instructions.md
Created September 10, 2019 02:01 — forked from pgilad/Instructions.md
Git commit-msg hook to validate for jira issue or the word merge

Instructions

  • copy the file commit-msg to .git/hooks/commit-msg
  • make sure your delete the sample file .git/hooks/commit-msg.sample
  • Make commit msg executable. chmod +x .git/hooks/commit-msg
  • Edit commit-msg to better fit your development branch, commit regex and error message
  • Profit $$

Shell example