typicode / husky

Git hooks made easy 🐶 woof!
https://typicode.github.io/husky
MIT License
31.68k stars 996 forks source link

cannot commit anything due to this error: `unknown revision or path not in the working tree.` #1412

Closed kasir-barati closed 1 month ago

kasir-barati commented 1 month ago

Context Please describe your issue and provide some context:

Here you can see my pre-commit file: pre commit Nothing out of ordinary.

And here is the issue:

$ git add .
$ git commit -m "chore: convert shared to a library"
fatal: ambiguous argument '': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Running actionlint against github workflows...
Running lint-staged...
husky - pre-commit hook exited with code 1 (error)

Does not matter if I use VSCode extension or terminal, either way it is failing.

Environment configurations and versions:

Thank you!

kasir-barati commented 1 month ago

OK, let me explain what I was doing wrong:

  1. I was using an env which was not defined at all :sweat_smile: ($DICTIONARY)
  2. In my lint-staged conf file I was removing ignored files but in one of my .eslintrc.json files I was extending from an eslintrc conf file that did not exists (more accurately speaking the path was wrong)

./lint-staged.config.js: image ./packages/shared/.eslintrc.json: image So as you might have already guessed it I should have used "extends": ["../../.eslintrc.json"], instead of "extends": ["../.eslintrc.json"],. I was refactoring my code and forgot to fix these kind of confs