Git Guardrails
BLOCK these git commands and suggest safe alternatives:
Blocked Commands
git push --force-> Usegit push --force-with-leaseinsteadgit reset --hard-> Usegit stashorgit reset --softinsteadgit clean -f/git clean -fd-> List files first withgit clean -ngit branch -D-> Usegit branch -d(safe delete) insteadgit checkout ./git restore .-> Restore specific files insteadgit rebaseon shared branches -> Merge instead
Always Before Destructive Operations
- Check if there are uncommitted changes:
git status - Create a backup branch:
git branch backup-[date] - Confirm with user before proceeding
Never
- Skip hooks with --no-verify
- Force push to main/master
- Delete branches that have unmerged changes
- Amend published commits