I have often made a commit, and then noticed that one of the files i was working on wasn't saved, and therefore were left out of the commit.
I have my current project set up with Husky, and have automated things like testing / linting before commit or push.
Here is the current Husky setup, just to give an idea of where a script could fit in.
"husky": {
"hooks": {
"pre-commit": "pretty-quick --staged && ng lint",
"pre-push": "ng test --browsers ChromeHeadless --watch=false && testcafe -c 4 chrome:headless test"
}
}
Is there any way to make visual studio or Husky save all open files pre-commit?
@Will Taylor's answer inspired me to do some searching.
I found the "files.autoSave": "onFocusChange"
setting in VSCode, and it solved my problem
to a satisfactory degree. Because the file is loosing focus when I write in the terminal, it is saved befor I commit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With