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
Testing Trophyは叫ばない
toms74209200
0
860
Kiroで始めるAI-DLC
kaonash
2
580
パッケージ設計の黒魔術/Kyoto.go#63
lufia
3
430
print("Hello, World")
eddie
2
530
MCPでVibe Working。そして、結局はContext Eng(略)/ Working with Vibe on MCP And Context Eng
rkaga
5
2.3k
アプリの "かわいい" を支えるアニメーションツールRiveについて
uetyo
0
260
OSS開発者という働き方
andpad
5
1.7k
ファインディ株式会社におけるMCP活用とサービス開発
starfish719
0
320
為你自己學 Python - 冷知識篇
eddie
1
350
ProxyによるWindow間RPC機構の構築
syumai
3
1.2k
Cache Me If You Can
ryunen344
2
700
AI Coding Agentのセキュリティリスク:PRの自己承認とメルカリの対策
s3h
0
200
Featured
See All Featured
Raft: Consensus for Rubyists
vanstee
140
7.1k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
Imperfection Machines: The Place of Print at Facebook
scottboms
268
13k
What's in a price? How to price your products and services
michaelherold
246
12k
A better future with KSS
kneath
239
17k
Making Projects Easy
brettharned
117
6.4k
Building Flexible Design Systems
yeseniaperezcruz
328
39k
Build The Right Thing And Hit Your Dates
maggiecrowley
37
2.9k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
23
1.4k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
53
2.9k
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.