Git Safety Rules and Operations
Git operations require user confirmation. The AI must never run destructive git commands without explicit approval.
Safety Rules
NEVER run these commands without user confirmation:
git addgit commitgit pushgit checkout -b(create branch)git mergegit branch -d/git branch -D(delete branch)git reset --hardgit push --forcegit rebase
Always:
- Show the command before running it
- Wait for approval — "OK to proceed?"
- Explain what it does if the user might not know
Never:
- Skip hooks (
--no-verify) - Force push to main/master
- Amend published commits without asking
- Delete branches without asking
Branch Naming
| Context | Pattern | Example |
|---|---|---|
| Feature work | feature/<short-name> | feature/add-search |
| Bug fix | fix/<short-name> | fix/mobile-nav |
| From an issue | issue-<number>-<short-name> | issue-42-auth-bug |
Common Operations
Create a feature branch
git checkout -b feature/my-feature
Commit changes
git add <specific-files>
git commit -m "Description of changes"
Prefer adding specific files over git add . or git add -A to avoid accidentally committing sensitive files.
Push and create PR
git push -u origin feature/my-feature
Then create a Pull Request (see platform-specific sections below).
Merge and clean up
git checkout main
git pull
git branch -d feature/my-feature
GitHub Operations
Use the GitHub CLI (gh) for GitHub-specific operations.
Create a Pull Request
gh pr create --title "Add feature X" --body "Description of changes"
View an issue
gh issue view <number>
Close an issue
gh issue close <number> --comment "Fixed in commit <hash>"
List open issues
gh issue list
Merge a Pull Request
gh pr merge <number> --merge
Azure DevOps Operations
Use the Azure CLI (az) for Azure DevOps operations.
Create a Pull Request
az repos pr create --title "Add feature X" --description "Description of changes" --source-branch feature/my-feature --target-branch main
Link to a work item
az repos pr create --title "Add feature X" --work-items <work-item-id> --source-branch feature/my-feature --target-branch main
List Pull Requests
az repos pr list --status active
Complete a Pull Request
az repos pr update --id <pr-id> --status completed
Commit Message Style
Follow the existing commit message style in the repository. Check recent commits:
git log --oneline -10
General guidelines:
- Start with a verb (Add, Fix, Update, Remove, Refactor)
- Keep the first line under 72 characters
- Use the body for details if needed