This week's friday micro-improvement: a pre-commit hook to remind me when I've marked a file as `skip-worktree` from the git index. (Sometimes I want to keep a non-prod change locally, without accidentally including it in a commit.)
Comments
Log in with your Bluesky account to leave a comment
Hilariously, for the project I'm using it, it will always emit the `.husky/pre-commit` file as being marked as `skip-worktree`....because I marked this hook change as `skip-worktree`.
Comments
```sh
SKIPPED=$(git ls-files -v | grep '^S' | cut -c 3-)
if [ -n "$SKIPPED" ]; then
echo "⚠️ Reminder -- You have skip-worktree files:"
echo "$SKIPPED" | sed 's/^/⚠️ /'
echo "⚠️ To unskip them, run 'git update-index --no-skip-worktree
fi
```