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
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
從冷知識到漏洞,你不懂的 Web,駭客懂 - Huli @ WebConf Taiwan 2025
aszx87410
2
3.4k
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
250
gunshi
kazupon
1
140
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
110
PC-6001でPSG曲を鳴らすまでを全部NetBSD上の Makefile に押し込んでみた / osc2025hiroshima
tsutsui
0
210
CSC307 Lecture 01
javiergs
PRO
0
670
AI Agent Dojo #4: watsonx Orchestrate ADK体験
oniak3ibm
PRO
0
130
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
440
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
2.2k
AI Agent Tool のためのバックエンドアーキテクチャを考える #encraft
izumin5210
6
1.6k
[AtCoder Conference 2025] LLMを使った業務AHCの上⼿な解き⽅
terryu16
6
1k
Vibe codingでおすすめの言語と開発手法
uyuki234
0
180
Featured
See All Featured
The Mindset for Success: Future Career Progression
greggifford
PRO
0
210
GraphQLの誤解/rethinking-graphql
sonatard
74
11k
Scaling GitHub
holman
464
140k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Leo the Paperboy
mayatellez
3
1.3k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
790
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
47
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.8k
Building Applications with DynamoDB
mza
96
6.9k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.8k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
42
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.