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
Joseph Hsu
April 14, 2012
Programming
700
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Git Hooks: How to Make Friends
Joseph Hsu
April 14, 2012
More Decks by Joseph Hsu
See All by Joseph Hsu
Ruby 2.0
jhsu
3
230
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
リアルな遅延を測る仕様
kota_yata
1
130
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
120
AIの中の人になってみる
htkym
0
140
in-process GraphQL のすすめ #ginzajs
izumin5210
4
1.5k
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
170
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
290
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
240
源内ハンズオン概要編
hideg
0
220
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
570
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
100
Go 1.27からのGODEBUG / Go 1.27 リリースパーティ #go127party
mazrean
0
260
Oxlintはいいぞ(続)
yug1224
1
480
Featured
See All Featured
ラッコキーワード サービス紹介資料
rakko
1
4.6M
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Docker and Python
trallard
47
4.2k
Designing for Performance
lara
611
70k
Practical Orchestrator
shlominoach
191
12k
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
310
Evolving SEO for Evolving Search Engines
ryanjones
0
270
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
670
Game over? The fight for quality and originality in the time of robots
wayneb77
1
260
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.8k
Navigating Weather and Climate Data
rabernat
0
490
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.