Improve your git experience with git hooks:
Git hooks: Enables you to run custom scripts on important events, eg., git commit. Client-side hooks are triggered by operations such as committing and merging Server-side hooks run on network operations such as receiving push
precommit hooks:
#!/bin/bash
echo "__________BRANCH NAME VALIDATION_______"
local_branch="$(git rev-parse --abbrev-ref HEAD)"
echo "LOCAL BRANCH NAME: " $local_branch
valid_branch_regex="^(feat|feature|bugfix|fix|release|hotfix|test|refactor|docs|style)\/[a-z0-9._-]+$"
message="There is something wrong with your branch name. Branch names in this project must adhere to
this contract: $valid_branch_regex. Your commit will be rejected. You should rename your branch to a
valid name and try again."
if [[ ! $local_branch =~ $valid_branch_regex ]]
then
echo "$message"
echo "Allowed branch prefix are feat|feature|bugfix|fix|release|hotfix|test|refactor|docs|style "
exit 1
fi
exit 0
done
In questa pagina del sito puoi guardare il video online Git hooks: Improve your git experience with git hooks della durata di ore minuti seconda in buona qualità , che l'utente ha caricato TheMidnightSky 24 gennaio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 115 volte e gli è piaciuto 7 spettatori. Buona visione!