Git Command Preferences

Git Diff Usage

  • Always try to use git commands without git prompting for user input (e.g. by default git diff using vi/m and needs to be closed)
  • Show diffs directly in command output for immediate review

Branch and Push Safety

  • NEVER push to main branch directly - All pushes go to feature branches only
  • NEVER commit to main locally - Always work on feature branches
  • Work on feature branches until ready, then create PR and stop
  • After creating PR: wait for user to merge OR prompt “Ready to merge?” and wait for confirmation
  • Show git status when relevant to understand current state

Pull Requests and Merging

  • NEVER merge pull requests or merge requests unless specifically requested by the user and confirmed
  • AI agents create PRs and push updates to feature branches
  • Default behavior: create PR and let user merge via GitHub/GitLab UI
  • Merging requires BOTH:
    1. Explicit user request to merge
    2. Confirmation from user before executing the merge
  • If in doubt, always ask before merging

Creating Pull Requests - Rebase Workflow

  • ALWAYS rebase on main BEFORE creating PR to avoid merge conflicts
  • Workflow:
    1. Create feature branch: git checkout -b feature/name
    2. Make changes and commit
    3. Rebase on latest main: git fetch origin && git rebase origin/main
    4. Resolve any conflicts locally (don’t push unresolved conflicts)
    5. Push clean branch: git push -u origin feature/name
    6. Create PR: gh pr create --fill
  • Never create new branches to avoid conflicts - instead rebase on existing branch and force-push
  • This ensures PRs merge cleanly without GitHub conflicts

Other Git Preferences

  • Do not commit to git unless explicitly asked
  • Always add files explicitly - NEVER use git add -A or git add .