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
220
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
nilとは何か 〜interfaceの構造とnil!=nilから理解する〜
kuro_kurorrr
3
1.9k
Agentic AI: Evolution oder Revolution
mobilelarson
PRO
0
150
Takumiから考えるSecurity_Maturity_Model.pdf
gessy0129
1
140
Claude Code Skill入門
mayahoney
0
200
AIコーディングの理想と現実 2026 | AI Coding: Expectations vs. Reality 2026
tomohisa
0
1.2k
Go1.26 go fixをプロダクトに適用して困ったこと
kurakura0916
0
360
nuget-server - あなたが必要だったNuGetサーバー
kekyo
PRO
0
230
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
160
株式会社 Sun terras カンパニーデック
sunterras
0
2.1k
Swift ConcurrencyでよりSwiftyに
yuukiw00w
0
250
PostgreSQL を使った快適な go test 環境を求めて
otakakot
0
540
go directiveを最新にしすぎないで欲しい話──あるいは、Go 1.26からgo mod initで作られるgo directiveの値が変わる話 / Go 1.26 リリースパーティ
arthur1
2
530
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.3k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
290
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.4k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
Product Roadmaps are Hard
iamctodd
PRO
55
12k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
74
Become a Pro
speakerdeck
PRO
31
5.8k
Facilitating Awesome Meetings
lara
57
6.8k
The Anti-SEO Checklist Checklist. Pubcon Cyber Week
ryanjones
0
89
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
60
42k
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.4k
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.