Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Git Hooks: How to Make Friends
Search
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
開発に寄りそう自動テストの実現
goyoki
2
1.4k
Navigation 3: 적응형 UI를 위한 앱 탐색
fornewid
1
440
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
1.7k
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
230
Combinatorial Interview Problems with Backtracking Solutions - From Imperative Procedural Programming to Declarative Functional Programming - Part 2
philipschwarz
PRO
0
110
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
270
メルカリのリーダビリティチームが取り組む、AI時代のスケーラブルな品質文化
cloverrose
2
340
Rubyで鍛える仕組み化プロヂュース力
muryoimpl
0
150
Go コードベースの構成と AI コンテキスト定義
andpad
0
130
ゆくKotlin くるRust
exoego
1
140
まだ間に合う!Claude Code元年をふりかえる
nogu66
5
880
愛される翻訳の秘訣
kishikawakatsumi
3
340
Featured
See All Featured
How STYLIGHT went responsive
nonsquared
100
6k
Discover your Explorer Soul
emna__ayadi
2
1k
The Pragmatic Product Professional
lauravandoore
37
7.1k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Building an army of robots
kneath
306
46k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
400
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
180
The Limits of Empathy - UXLibs8
cassininazir
1
190
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
79
The Curse of the Amulet
leimatthew05
0
4.6k
The Power of CSS Pseudo Elements
geoffreycrofte
80
6.1k
Prompt Engineering for Job Search
mfonobong
0
120
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.