"Git Hooked!" Using Git hooks to improve your software development process
-
Upload
joomla-resource-directory -
Category
Software
-
view
489 -
download
0
description
Transcript of "Git Hooked!" Using Git hooks to improve your software development process
Milton BryantDevOps Lead
for Polished Geek
GitHooked!
Milton BryantDevOps Lead at Polished Geek
Working with Joomla since 2010
Email - [email protected]
Twitter - @Krealic
What hooks are &
how to use them
Demo #1
Triggering unit test(s) with pre-commit git hook
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
CheckoutRebase
post-checkoutpre-rebase
Merge
post-merge
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
pre-commitcode validationunit testscheck for missing files
If fail, aborts with message and no commit
Alert you to merge conflict code inside of files
Execute Scripts
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
prepare-commit-msgedit pre-defined template messages
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
commit-msgruns during commituse to ensure standards followed
Example: abort commit if JIRA issue resolution comments missing
Send a pre-defined message or enforce commit signature policy
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
post-commitruns only after successful commituse for notifications
Notify users when commits or pushes have been made
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
pre-receiveenforce dev policies
can reject entire push
Generate/update ticket or issue under related project
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
updateexecutes per branch
updatedPass/Fail per branch
updated
“mini-pre-receive”
Changes to
CommitCommit Push Repo
Update
Local Remote
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-receive
update
post-receive
post-receiveteam notifications
continuous integration
only runs after successful update
Build Log Files
Relocate Files
Demo #2Sending a notification to Slack with the post-commit git hook
Top 5 Tips
Tip #1By default, git hooks are not shared to the remote repository.
Tip #2You can create a symbolic link from a “hooks” directory
Tip #3If responses flicker too fast on the screen, pool them to a file.
Tip #4It is possible to bypass hooks by using --no-verify, --no-merge or –no-checkout
Tip #5With git hooks, you can…
Milton BryantDevOps Lead
[email protected]@KrealicPolishedGeek.com @PolishedGeek
Slides available online https://PolishedGeek.com/githooked
??? ??