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
GitHub Copilotの全体像と活用のヒント AI駆動開発の最初の一歩
74th
7
2.3k
抽象化という思考のツール - 理解と活用 - / Abstraction-as-a-Tool-for-Thinking
shin1x1
1
950
11年かかって やっとVibe Codingに 時代が追いつきましたね
yimajo
1
250
物語を動かす行動"量" #エンジニアニメ
konifar
13
3.7k
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
690
GUI操作LLMの最新動向: UI-TARSと関連論文紹介
kfujikawa
0
720
LLMは麻雀を知らなすぎるから俺が教育してやる
po3rin
3
2k
令和最新版手のひらコンピュータ
koba789
13
6.9k
CLI ツールを Go ライブラリ として再実装する理由 / Why reimplement a CLI tool as a Go library
ktr_0731
3
1k
PHPUnitの限界をPlaywrightで補完するテストアプローチ
yuzneri
0
390
階層化自動テストで開発に機動力を
ickx
1
480
React は次の10年を生き残れるか:3つのトレンドから考える
oukayuka
41
16k
Featured
See All Featured
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
22
1.4k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
29
9.6k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
8
750
Six Lessons from altMBA
skipperchong
28
3.9k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Navigating Team Friction
lara
188
15k
What's in a price? How to price your products and services
michaelherold
246
12k
The Invisible Side of Design
smashingmag
301
51k
Bash Introduction
62gerente
614
210k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
How to train your dragon (web standard)
notwaldorf
96
6.2k
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.