-
-
Notifications
You must be signed in to change notification settings - Fork 104
Closed
Labels
Description
Describe the bug
From the looks of it, whenever one attempts to commit any changes while having untracked files in their working tree, the pre-commit hook also includes these files in the commit. This is somewhat severe because I accidentally shared some untracked configuration files that included a Discord bot token for my testing bot, which was thankfully revoked by Discord itself as soon as I pushed.
Expected behavior
The pre-commit hooks should not include untracked files.
To Reproduce
- Make a new file in the working directory that is not tracked by
.gitignore. - Ensure that the file is untracked by using
git restore --staged <file_name>. - Change a different file's contents, such as a Java source code file that is tracked.
- Add the Java source code file to the index and make a commit from it.
- Assuming the pre-commit hook was executed with your commit, you should now see the untracked file included in the commit.
Additional context
macOS version: Sonoma 14.3.1 (23D60)
git version: 2.39.3 (Apple Git-145)


