logoalt Hacker News

a_t48yesterday at 9:58 AM2 repliesview on HN

Running on the working tree is mostly okay - just `exit 1` if changes were made and allow the user to stage+commit new changes. It isn't perfect but it doesn't require checking out a new tree.


Replies

seniorsassycattoday at 1:28 AM

What if I've already fixed the format issue (but not staged it). The pre-commit hook will pass, but it's not doing what the author intended (preventing unformated code from being committed).

What if I've only staged one part of a file, but the pre-commit hook fails on the unstaged portions, which should be fine since I'm not commiting or pushing those changes.

show 1 reply
jynelsonyesterday at 11:50 AM

this completely breaks `git add -p`.

show 1 reply