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
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
430
AIと一緒にレガシーに向き合ってみた
nyafunta9858
0
240
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1k
CSC307 Lecture 08
javiergs
PRO
0
670
dchart: charts from deck markup
ajstarks
3
990
0→1 フロントエンド開発 Tips🚀 #レバテックMeetup
bengo4com
0
570
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
2.5k
Oxlint JS plugins
kazupon
1
950
それ、本当に安全? ファイルアップロードで見落としがちなセキュリティリスクと対策
penpeen
7
3.9k
Package Management Learnings from Homebrew
mikemcquaid
0
220
Featured
See All Featured
Fireside Chat
paigeccino
41
3.8k
How to make the Groovebox
asonas
2
1.9k
The agentic SEO stack - context over prompts
schlessera
0
640
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
140
Between Models and Reality
mayunak
1
190
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
GitHub's CSS Performance
jonrohan
1032
470k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
340
Music & Morning Musume
bryan
47
7.1k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
220
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.