| ▲ | teaearlgraycold 4 hours ago | |
It doesn’t seem like this solves the main issues with pre-commit hooks. They are broken by design. Just to name 2, they run during rebase and aren’t compatible with commits that leave unstaged files in your tree. | ||
| ▲ | tomjakubowski an hour ago | parent | next [-] | |
> they … aren’t compatible with commits that leave unstaged files in your tree. It's a little surprising that git doesn't pass pre-commit hooks any information, like a list of which files were changed in the soon-to-be-made commit. git does so for pre-push, where it writes to a hook's stdin some information about the refs and remotes involved in the push. I wonder if many pre-commit hooks, like the kind which run formatters, would be better off as `clean` filters, which run on files when they are staged. The filter mechanism makes it easier to apply just to the files which were changed. In the git docs, they even use a formatter (`indent`) as an example. https://git-scm.com/book/ms/v2/Customizing-Git-Git-Attribute... | ||
| ▲ | bradleyy an hour ago | parent | prev [-] | |
I leave unstaged files all the time, not sure what you mean. | ||