THESE RULES ARE ABSOLUTE. NEVER EXCEPTIONS.
NEVER RUN:
git gc --prune=noworgit gc --prunegit reflog expire --expire=now --allgit reflog expire --allgit filter-branch(any variant)git replace(for history rewriting)git rebase -i(interactive rebase on shared/pushed commits)git reset --hardwithout explicit user confirmationgit push --forceorgit push -frm -rf .git(under ANY circumstances)
DO THIS INSTEAD:
- Stop immediately
- Run:
git reflogandgit fsck --lost-found - Ask the user: "What do you want me to do?"
- Wait for explicit instruction before proceeding
- Describe the problem clearly with examples
These are safe to use:
git loggit showgit diffgit statusgit branchgit reset --soft(only if user explicitly requests)git commit(after user stages changes)git add/git stagegit checkout(switching branches)git fetchgit push(non-force)
BEFORE COMMITTING:
- Verify branch is correct:
git branch - Verify no unintended changes:
git statusandgit diff --cached - Verify commit message is clear and follows
feat(scope):format - PAUSE and ask if anything looks wrong
NEVER:
- Squash commits without explicit user request
- Reorder commits
- Modify commit messages without permission
- Commit to master directly
You have destroyed work. Acknowledge it and help recover:
- Check if remote has the branch (
git branch -r) - If yes:
git fetch origin <branch>and restore - If no: Data is lost. Apologize and rebuild work with user guidance
Remember: Destructive git operations are PERMANENT when reflogs are deleted and gc prunes.
See also: .github_project_infrastructure.md for build system and toolchain details.