pretty-quick: pretty-quick does not find any changed file
I’m working with node 12.18.1, prettier@2.0.5, and pretty-quick@3.1.0 on a windows 10 computer. I have this strange behaviour:
$ git status
On branch feature/code-quality
Your branch is up to date with 'origin/feature/code-quality'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: src/app/app.component.spec.ts
then
$ npx pretty-quick --staged
� Finding changed files since git revision 2ba99b6.
� Found 0 changed files.
✅ Everything is awesome!
but
$ npx prettier --check **
Checking formatting...
src\app\app.component.spec.ts
Code style issues found in the above file(s). Forgot to run Prettier?
Any idea ?
About this issue
- Original URL
- State: open
- Created 3 years ago
- Comments: 15 (1 by maintainers)
i was also getting the
git revision nullmessage when i rannpx pretty-quick --stagedNeeded to add the
--branch mainflag since it compares againstmasterby default (as it says in the docs - which i did not read).I have a similar problem but it just returns “Git Revision null”
I get this behaviour when performing this in a GitHub action.
How to use this in GitHub Actions with actions/checkout@v3? I have tried to set fetch-depth=0 but still no changes found. Locally the same command works nicely so I guess the problem is in Github’s way to do checkout.
I had an issue where
pretty-quickwas including files in our monorepo in parent folders relative to where I was running it, but I hadn’t changed. Turns out using this flag against the target branch fixed my issue. Thanks!The issue is, that
pretty-quickusesgitunder the hood. If you usealpineor ubuntuslimimages, they usually don’t havegitcommand out of the box. Make sure, that you installgitin your CI runner.