lint-staged failed due to a git error
See original GitHub issueDescription
Unable to commit due to git error while nothing was done except for changing some files.
Steps to reproduce
git commit -m 'msg'
Debug Logs
[STARTED] Preparing…
lint-staged:git Backing up original state… +0ms
lint-staged:git Getting partially staged files… +0ms
lint-staged:git Running git command [ ‘status’, ‘-z’ ] +89ms
lint-staged:git Found partially staged files: [] +30ms
lint-staged:git Backing up merge state… +0ms
lint-staged:file Reading file .../.git/MERGE_HEAD +0ms
lint-staged:file Reading file .../.git/MERGE_MODE +0ms
lint-staged:file Reading file .../.git/MERGE_MSG +0ms
lint-staged:file File .../.git/MERGE_HEAD doesn’t exist, ignoring… +1ms
lint-staged:file File .../.git/MERGE_MODE doesn’t exist, ignoring… +0ms
lint-staged:file File .../.git/MERGE_MSG doesn’t exist, ignoring… +0ms
lint-staged:git Done backing up merge state! +1ms
lint-staged:git Getting deleted files… +56ms
lint-staged:git Running git command [ ‘ls-files’, ‘–deleted’ ] +87ms
lint-staged:git Found deleted files: [] +13ms
lint-staged:git Running git command [ ‘stash’, ‘create’ ] +13ms
lint-staged:git Running git command [
‘stash’,
‘store’,
‘–quiet’,
‘–message’,
‘lint-staged automatic backup’,
‘’
] +19ms
[FAILED] Preparing…
[STARTED] Running tasks…
[SKIPPED] Skipped because of previous git error.
[STARTED] Applying modifications…
[SKIPPED]
[SKIPPED] ✖ lint-staged failed due to a git error.
[STARTED] Cleaning up…
[SKIPPED]
[SKIPPED] ✖ lint-staged failed due to a git error.
✖ lint-staged failed due to a git error. Any lost modifications can be restored from a git stash:
> git stash list
stash@{0}: automatic lint-staged backup
> git stash apply --index stash@{0}
expand to view
COPY THE DEBUG LOGS HERE
Environment
- OS: macOS Big Sur
- Node.js: v12.18.2
lint-staged: 10.5.1
Issue Analytics
- State:
- Created 3 years ago
- Reactions:14
- Comments:9
Top Related StackOverflow Question
I’m experiencing the same error in monorepo using Lerna to run lint-staged in all workspaces/packages (
lint:stagedis just a script in package.json that runslint-stagedversion 11.0.1).The command
yarn workspace b2b lint:stagedran by itself is finished successfully.I’m bypassing the error above by using
--no-verify. However this happens only if there is a huge amount of changes to be committed. When I commit a single change the problem is not there and lint works well.@quadristan You are right, the problem is, that
pnpm -rwill run in concurrency (currently 4 processes); I simply calllint-stagednow withpnpm -r --workspace-concurrency=1 lint-stagedand everything works like a charm!