I have a pre-commit hook which modifies some files before they are committed; however when the hook runs, the files that it modifies do not get committed! How can I have the files included? I need this to work both for staged commits and unstaged "commit all modified files" commits, so I don't think staging the modified file will work here because that would exclude the original files in the latter case (since they are not staged).
Here's a simple reproduction case:
#!C:/Program\ Files/Git/usr/bin/sh.exe echo "Test file" > testfile.txt If I change a file and commit, the testfile.txt never gets committed; if I change a file, stage it, and commit, the same thing happens - testfile.txt is sitting there as a pending change.
git add testfile.txtto the hook.