You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Context
When using git worktrees the pre-commit hook has some strange behaviours. I have a pre-commit hook that may create a new file based on yarn build output but it can also be reproduced with the following snipplet in the .husky/pre-commit file in a git worktree setup.
When running a commit git commit -am "test" the hook will suddenly create a file test.txt in the root directory and in the subfolder as well. Also the test.txt in the root is added to the commit but then deleted which results in the following status right after running the git commit command
git status
On branch husky-wt-poc
Changes not staged for commit:
(use "git add/rm <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
deleted: ../test.txt
Untracked files:
(use "git add <file>..." to include in what will be committed)
test.txt
no changes added to commit (use "git add" and/or "git commit -a")
Expected behaviour
The expectations with a git add test.txt in the pre-commit would be that the file created in subfolder/test.txt is added and that no test.txt is created in the root.
The text was updated successfully, but these errors were encountered:
Troubleshoot
https://typicode.github.io/husky/troubleshoot.html
Context
When using git worktrees the pre-commit hook has some strange behaviours. I have a pre-commit hook that may create a new file based on
yarn build
output but it can also be reproduced with the following snipplet in the.husky/pre-commit
file in a git worktree setup.When running a commit
git commit -am "test"
the hook will suddenly create a filetest.txt
in the root directory and in thesubfolder
as well. Also thetest.txt
in the root is added to the commit but then deleted which results in the following status right after running thegit commit
commandExpected behaviour
The expectations with a
git add test.txt
in the pre-commit would be that the file created insubfolder/test.txt
is added and that notest.txt
is created in the root.The text was updated successfully, but these errors were encountered: