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
700
5
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Git Hooks: How to Make Friends
Joseph Hsu
April 14, 2012
More Decks by Joseph Hsu
See All by Joseph Hsu
Ruby 2.0
jhsu
3
230
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
AWS CDK を「作」ってみた 〜フルスクラッチで見えた CDK の裏側〜 / aws-cdk-from-scratch
gotok365
3
2.8k
霧の中の代数的エフェクト
funnyycat
1
490
メールのエイリアス機能を履き違えない
isshinfunada
0
230
源内ハンズオン概要編
hideg
0
140
Cloudflare is Agents
chimame
0
150
自動化したのに回らないテスト運用の壁ーAI時代の品質責任と生産性
mfunaki
0
130
【QA Test Talk Vol.8】AI-DLC による Whole Team Approach の加速
pkshadeck
PRO
0
120
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
210
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
550
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
540
<title><a id="</title>君はこのHTMLをパースできるか"></a></title> #雑LT_study
pizzacat83
0
140
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
650
Featured
See All Featured
Crafting Experiences
bethany
1
240
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Between Models and Reality
mayunak
4
390
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
32
4.3k
Designing for Performance
lara
611
70k
Speed Design
sergeychernyshev
33
2k
Designing Powerful Visuals for Engaging Learning
tmiket
1
480
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Odyssey Design
rkendrick25
PRO
2
750
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
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.