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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
220
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
How to stabilize UI tests using XCTest
akkeylab
0
110
AHC061解説
shun_pi
0
360
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3.3k
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
190
AIに任せる範囲を安全に広げるためにやっていること
fukucheee
0
130
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
120
Ruby x Terminal
a_matsuda
7
590
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
230
「抽象に依存せよ」が分からなかった新卒1年目の私が Goのインターフェースと和解するまで
kurogenki
0
110
nilとは何か 〜interfaceの構造とnil!=nilから理解する〜
kuro_kurorrr
3
1.9k
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
430
AI時代のシステム設計:ドメインモデルで変更しやすさを守る設計戦略
masuda220
PRO
5
900
Featured
See All Featured
Marketing to machines
jonoalderson
1
5k
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
250
Art, The Web, and Tiny UX
lynnandtonic
304
21k
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
380
Darren the Foodie - Storyboard
khoart
PRO
3
2.8k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
199
73k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
290
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
26
3.4k
Crafting Experiences
bethany
1
83
Code Reviewing Like a Champion
maltzj
528
40k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
RailsConf 2023
tenderlove
30
1.4k
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.