Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Git Hooks: How to Make Friends
Search
Joseph Hsu
April 14, 2012
Programming
710
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
240
API Versioning
jhsu
1
1.4k
Other Decks in Programming
See All in Programming
AmebaブログはKMPから卒業します
kmars0605
0
210
PumaからFalconに移行したRailsアプリケーションでの実践
falcon8823
0
180
ジョジョの世界をXRで再現する
mofurune
0
180
JIS keyboard support in Omarchy
lef237
0
140
複雑なUIコンポーネントとの ⻑い付き合い⽅:波及するバグからテスト戦略を経て、安全な再設計へ
mixplace
0
440
dotNET_vulnclicker_intro.pdf
deka_morita
0
150
Optunaを作ったときにやりたかったこと、その後 (2026/10/16, Optuna Meetup #3)
iwiwi
2
960
Performance Optimization With LLMs
xleitix
0
160
Kotlinize Is Not Just Converting to Kotlin
chigichan24
1
160
パズルゲームの作り方 / how to make puzzle games
kaityo256
PRO
2
300
Kotlinの15年とServer-Side Kotlin
n_takehata
1
160
【加筆修正版】Laravel のアプリケーションをどこにデプロイするか #phpcon_ehime
akase244
0
150
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
77
5.6k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
Are puppies a ranking factor?
jonoalderson
2
4.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
560
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
How to Think Like a Performance Engineer
csswizardry
28
2.9k
Git: the NoSQL Database
bkeepers
PRO
433
67k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
3k
Automating Front-end Workflow
addyosmani
1369
210k
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
Accessibility Awareness
sabderemane
1
250
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.