Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Git Hooks: How to Make Friends
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Joseph Hsu
April 14, 2012
Programming
5
690
Git Hooks: How to Make Friends
Joseph Hsu
April 14, 2012
Tweet
Share
More Decks by Joseph Hsu
See All by Joseph Hsu
Ruby 2.0
jhsu
3
210
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
280
MUSUBIXとは
nahisaho
0
130
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
2.5k
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
AI時代の認知負荷との向き合い方
optfit
0
160
AI巻き込み型コードレビューのススメ
nealle
1
230
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
130
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
CSC307 Lecture 06
javiergs
PRO
0
680
カスタマーサクセス業務を変革したヘルススコアの実現と学び
_hummer0724
0
700
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.3k
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
400
Featured
See All Featured
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
91
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
3.9k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
140
Scaling GitHub
holman
464
140k
Code Review Best Practice
trishagee
74
20k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
68
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
430
Game over? The fight for quality and originality in the time of robots
wayneb77
1
120
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
270
A Modern Web Designer's Workflow
chriscoyier
698
190k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Transcript
by Joseph Hsu GIT HOOKS HOW TO MAKE FRIENDS
GIT HOOKS by Joseph Hsu HOW TO MAKE FRIENDS
@JHSU Joe Hsu
We all use git (right?)
DVCS - distributed version control system
None
None
None
I wish I could automate...
too lazy to...
Git hooks
Git hooks http://book.git-scm.com/5_git_hooks.html Hooks are little scripts you can place
in $GIT_DIR/ hooks directory to trigger action at certain points.
post-commit no parameters cannot affect the outcome of git-commit
pre-commit run tests, linting
post-receive # <oldrev> <newrev> <refname>
and more...
setup
where? project .git/hooks new repos /usr/share/git-core/templates/hooks/
chmod +x
post-hook What happens after depends on exit status, exit of
non-zero leaves dirty state
pre-commit #!/usr/bin/env bash exit 1
#!/usr/bin/env bash git reset HEAD^ --hard post-commit
Useful examples
cowsay commit-msg * WOOF * * WOOF *
fixing bugs, BRO commit-msg
git commit -m “stuff” commit-msg
None
None
None
AlTeRnAtInG cAsE commit-msg
https://github.com/jhsu/githooks
Thanks.