After pushing my code to the remote branch and creating a PR. I made some more changes to my local code and then, when I want to commit the new change and push it to te remote again, I get following “git warning message” :
Solution:
- If we Look at the husky line on our screenshot, we have a pre-commit hook running here.
- The reason it fires would have to be found in the hook itself, but it looks like the linting process deems that we changed only whitespace ( we can check it with
git diff --staged
just before committing).
So if we do want to commit only our whitespace changes but the hook prevents it, let us check .git/hooks/pre-commit
and consider using -n
for our commit command (--no-verify
) to commit without triggering the hook. ( git commit -n )
An alternative would be to use --allow-empty
as hinted in yellow, but without knowing exactly what’s in our lint hook, hard to say for sure. Who set up our repo/workflow? That hook has likely been put here for a reason, so be sure to discuss the matter with them, before doing anything.