Git Ops
Overview
Handle routine Git operations with safety-first constraints, clear commit messaging, and minimal history risk.
Workflow
- •Inspect repo state
- •Use
git status -sbandgit diffto understand current changes. - •Avoid touching unrelated user changes; never revert changes you did not make.
- •Choose the safest path
- •Prefer non-destructive operations and reversible steps.
- •Avoid
git reset --hardorgit checkout --unless explicitly requested.
- •Apply changes
- •Stage only relevant files.
- •If a command would rewrite history (rebase, amend, force push), require explicit user intent.
- •Create commits
- •Check commit message patterns in history first.
- •If no pattern exists, use Conventional Commits.
- •GitHub interactions
- •Prefer the
ghCLI when interacting with GitHub.
Commit Conventions
- •Inspect prior commits to mirror existing style.
- •Default to Conventional Commits when no clear pattern exists.
Rebase/Merge Guidance
- •Prefer fast-forward updates, then rebase, then merge (in that order).
- •When running rebase, use non-interactive mode with
EDITOR=trueto avoid blocking. - •Do not recommend or execute history-rewriting commands unless explicitly requested.
Destructive-Operation Gate
- •Warn before destructive operations and provide safer alternatives.
- •Confirm explicit intent before executing irreversible actions.
Reference
Read references/git-ops.md for the full source guidance extracted from .codex/AGENTS.md.