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
PJのドキュメントを全部Git管理にしたら、一番喜んだのはAIだった
nanaism
0
230
並行開発のためのコードレビュー
miyukiw
2
2.2k
New in Go 1.26 Implementing go fix in product development
sunecosuri
0
250
CSC307 Lecture 10
javiergs
PRO
1
690
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
420
Go Conference mini in Sendai 2026 : Goに新機能を提案し実装されるまでのフロー徹底解説
yamatoya
0
500
atmaCup #23でAIコーディングを活用した話
ml_bear
4
720
文字コードの話
qnighy
43
16k
猫の手も借りたい!ので AIエージェント猫を作って社内に放した話 Claude Code × Container Lambda の Slack Bot "DevNeko"
naramomi7
0
230
CopilotKit + AG-UIを学ぶ
nearme_tech
PRO
1
120
Railsの気持ちを考えながらコントローラとビューを整頓する/tidying-rails-controllers-and-views-as-rails-think
moro
4
370
15年目のiOSアプリを1から作り直す技術
teakun
0
580
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.6k
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
200
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Ethics towards AI in product and experience design
skipperchong
2
210
Design of three-dimensional binary manipulators for pick-and-place task avoiding obstacles (IECON2024)
konakalab
0
370
Navigating Team Friction
lara
192
16k
Done Done
chrislema
186
16k
Paper Plane
katiecoart
PRO
0
47k
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.8k
The untapped power of vector embeddings
frankvandijk
2
1.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Ten Tips & Tricks for a 🌱 transition
stuffmc
0
83
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.