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
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
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
170
1B+ /day規模のログを管理する技術
broadleaf
0
110
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
770
Lessons from Spec-Driven Development
simas
PRO
0
220
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
230
Spring Security 実践 ─ GraphQL APIで実務に役立つ 認証・認可 を学ぶ
wagyu
0
260
act1-costs.pdf
sumedhbala
0
110
Oxlintのカスタムルールの現況
syumai
6
1.2k
Even G2とAWSで推しのエージェントを召喚しよう!
har1101
1
120
Dataformのリポジトリを立ち上げるときにまずやること / dataform-day0-2026
snhryt
0
180
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
570
フロントエンドとバックエンドで「1文字」を揃えよう
youkidearitai
PRO
0
740
Featured
See All Featured
Done Done
chrislema
186
16k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
400
Mind Mapping
helmedeiros
PRO
1
260
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.7k
Thoughts on Productivity
jonyablonski
76
5.2k
AI Search: Implications for SEO and How to Move Forward - #ShenzhenSEOConference
aleyda
1
1.3k
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.5k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
GraphQLとの向き合い方2022年版
quramy
50
15k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
280
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
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.