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
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
400
AI時代の認知負荷との向き合い方
optfit
0
160
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
5
450
AIで開発はどれくらい加速したのか?AIエージェントによるコード生成を、現場の評価と研究開発の評価の両面からdeep diveしてみる
daisuketakeda
1
2.5k
Basic Architectures
denyspoltorak
0
670
AIによる高速開発をどう制御するか? ガードレール設置で開発速度と品質を両立させたチームの事例
tonkotsuboy_com
7
2.3k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
570
AgentCoreとHuman in the Loop
har1101
5
230
Smart Handoff/Pickup ガイド - Claude Code セッション管理
yukiigarashi
0
140
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
570
Featured
See All Featured
Unsuck your backbone
ammeep
671
58k
Keith and Marios Guide to Fast Websites
keithpitt
413
23k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
94
Amusing Abliteration
ianozsvald
0
100
Darren the Foodie - Storyboard
khoart
PRO
2
2.4k
The Cult of Friendly URLs
andyhume
79
6.8k
Statistics for Hackers
jakevdp
799
230k
Automating Front-end Workflow
addyosmani
1371
200k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.6k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
It's Worth the Effort
3n
188
29k
Reality Check: Gamification 10 Years Later
codingconduct
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.