---
description: Git operations policy for DevForgeAI
version: "1.0"
created: 2025-12-10
---

# Git Operations Policy

## Safe Operations (Auto-Approved)
- `git status`
- `git log`
- `git diff`
- `git branch` (list only)
- `git add`
- `git commit` (with message)
- `git push` (to current branch)

## Requires User Approval
- `git stash`
- `git reset --hard`
- `git push --force`
- `git branch -d` (delete)
- `git checkout -b` (new branch)
- `git merge`
- `git rebase`
- `git commit --amend`

## Forbidden Without Explicit Request
- `git push --force` to main/master
- `git reset --hard HEAD~N` (N > 1)
- Modifying `.git/hooks/`
- `git config --global`

## Enforcement

These tiers are enforced out-of-band, not by this prose:

- **Requires User Approval** — classified in `.claude/settings.json`
  `permissions.ask` (`git stash`, `git reset`, `git checkout`, `git merge`,
  `git rebase`, `git commit --amend`, `git branch -d`/`-D`,
  `git push --force`/`-f`). Claude Code prompts before running them.
- **`git config --global`** — `permissions.deny` blocks it outright.
- **Modifying `.git/hooks/`** — `pre-protected-path-write-guard.sh`
  (PreToolUse[Edit|Write], `exit 2`, no bypass) blocks `Edit`/`Write` to any
  `.git/hooks/` path, reinforced by the "Forbidden Without Explicit Request"
  policy above and HALT trigger #4 (`DevForgeAI.md`). This guard relocates the
  protection from the former dead `pre-tool-use.sh` Edit/Write branch — which was
  unreachable under its `Bash` matcher and removed (issue #140, ADR-106) — into a
  correctly-matched `Edit|Write` hook (issue #183, ADR-113). The same hook also
  blocks `Edit`/`Write` to system `/tmp/` and `/var/tmp/`.
- **`git commit --no-verify`** — `pre-commit-no-verify-guard.sh`
  (PreToolUse[Bash]) blocks it with `exit 2`. See `commit-failure-recovery.md`.
