I have a project where phpcbf is run by a pre-commit hook. Since phpcbf can't be limited to parts of a file, the hook will always stage a file in its entirety for commit, if that file was touched by phpcbf at all.
OTOH, I like to use git add -p to only stage parts of files for commit (and leave other changes unstaged); this helps me organize changes into multiple commits, stash some changes for later use, or simply leave out debug statements (to be removed later by e.g. git checkout -- .). However, if I try to commit those select changes, what I'll get instead is the entire file being committed, due to the aforementioned pre-commit hook that runs phpcbf.
I was thinking that this problem could be solved by having a phpcbf-changed command akin to phpcs-changed, which only beautifies lines that have changed with respect to a base reference (in my example, only lines that are staged for commit).
Would it be possible to add such a command to this repo? 😊
I have a project where
phpcbfis run by a pre-commit hook. Sincephpcbfcan't be limited to parts of a file, the hook will always stage a file in its entirety for commit, if that file was touched byphpcbfat all.OTOH, I like to use
git add -pto only stage parts of files for commit (and leave other changes unstaged); this helps me organize changes into multiple commits, stash some changes for later use, or simply leave out debug statements (to be removed later by e.g.git checkout --.). However, if I try to commit those select changes, what I'll get instead is the entire file being committed, due to the aforementioned pre-commit hook that runsphpcbf.I was thinking that this problem could be solved by having a
phpcbf-changedcommand akin tophpcs-changed, which only beautifies lines that have changed with respect to a base reference (in my example, only lines that are staged for commit).Would it be possible to add such a command to this repo? 😊