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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
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
AIと壁打ちしながら進めるコスト管理
fufuhu
2
1.8k
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
650
AI Readyの正体はデータマネジメントだ メダリオン2.0の最前線
freee
PRO
0
430
高専、大学編入、そして未踏へ〜プロダクト開発とキャリアの歩み - Technical College, University Transfer, and On to “Mitou” / My Journey in Product Development and Career
pkmiya
0
100
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
220
プロポーザルを書いてもらう
pvcresin
0
590
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
240
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
120
GKE アップグレード前に知っておきたい Blue/Green と PDB の関係
stkk
0
100
高専キャリア LT 発表内容
crysta1221
5
4.5k
MySQLとPostgreSQLって何が違うの?
akagami
0
150
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
570
Featured
See All Featured
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
500
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
670
Java REST API Framework Comparison - PWX 2021
mraible
34
9.7k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
220
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
220
Un-Boring Meetings
codingconduct
0
400
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
530
Public Speaking Without Barfing On Your Shoes - THAT 2023
reverentgeek
1
550
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
How GitHub (no longer) Works
holman
316
150k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Ruling the World: When Life Gets Gamed
codingconduct
0
310
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.