Git hooks: Improve your git experience with git hooks

Veröffentlicht am: 24 Januar 2021
auf dem Kanal: TheMidnightSky
115
7

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


Auf dieser Seite können Sie das Online-Video Git hooks: Improve your git experience with git hooks mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer TheMidnightSky 24 Januar 2021 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 115 Mal angesehen und es wurde von 7 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!