Summary
Replace git checkout HEAD^ with a temporary detached git worktree in scripts/diffcheck.sh. This eliminates side effects on the current branch and ensures clean cleanup.
Changes
- Add strict shell mode: set -Eeuo pipefail
- Use mktemp for temp files/dirs
- Build previous commit table in a detached worktree
- Add trap cleanup to remove worktree and temps
Why
- Prevents leaving the repo in detached HEAD
- Avoids accidental loss of uncommitted changes
- More CI-friendly and reproducible