Refined Git Preset
Powerful setting for configure, commit, behavior, including. Includes structured workflows, validation checks, and reusable patterns for global.
Refined Git Preset
Streamlined git configuration preset with sensible defaults for branch management and commit workflows.
When to Use This Setting
Apply this setting when you need to:
- Establish consistent git workflow defaults across all team members using Claude Code
- Configure standard branch protection, naming conventions, and commit message formatting rules
- Set up a lightweight git governance layer without the full complexity of Git Flow Consider alternatives when:
- Your team already uses Git Flow or another formal branching strategy with its own enforcement tooling
- You need minimal git configuration and prefer to manage conventions through documentation alone
Quick Start
Configuration
name: refined-git-preset type: setting category: global
Example Application
claude setting:apply refined-git-preset
Example Output
Setting applied. Changes:
- permissions.deny: [git push --force, git reset --hard]
- permissions.allow: [git status, diff, add, commit, push, pull, log, branch]
- env.GIT_DEFAULT_BRANCH: main
Core Concepts
Git Governance Overview
| Aspect | Details |
|---|---|
| Force Push Protection | Prevents accidental force pushes that can destroy team members' work |
| Hard Reset Guard | Blocks git reset --hard to prevent unrecoverable local changes loss |
| Standard Operations | Allows all common read and write git operations without prompts |
| Branch Defaults | Configures the default branch name and common branch prefixes |
Git Permission Architecture
+---------------------------+
| Git Operations |
+---------------------------+
| |
| ALLOWED: |
| +---------------------+ |
| | git status/diff/log | |
| | git add/commit | |
| | git push/pull | |
| | git branch/checkout | |
| | git merge/rebase | |
| | git fetch/tag | |
| +---------------------+ |
| |
| DENIED: |
| +---------------------+ |
| | git push --force | |
| | git push -f | |
| | git reset --hard | |
| | git clean -f | |
| +---------------------+ |
+---------------------------+
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
| permissions.allow | array | [] | List of git command patterns permitted without interactive confirmation |
| permissions.deny | array | [] | List of destructive git command patterns that are blocked entirely |
| GIT_DEFAULT_BRANCH | string | "main" | Default branch name for new repositories and merge targets |
| GIT_AUTHOR_NAME | string | N/A | Override the git author name for commits made through Claude Code |
| GIT_AUTHOR_EMAIL | string | N/A | Override the git author email for commits made through Claude Code |
Best Practices
- Start with deny rules for destructive operations - The most valuable part of a git preset is preventing data loss. Block force pushes and hard resets first, then expand the allow list based on your workflow needs.
- Allow common operations without prompts - Requiring interactive confirmation for git status or git diff creates friction without security benefit. Pre-allow read operations and standard write operations to keep development flowing.
- Standardize branch naming across the team - Even without full Git Flow enforcement, consistent branch prefixes like feat/, fix/, and chore/ improve repository readability and enable automation.
- Pair with commit message conventions - A git preset works best when combined with commit message validation. Conventional commits format enables automated changelog generation and semantic versioning.
- Review and update quarterly - As your team's git workflow evolves, revisit the allow and deny lists. New team members may introduce different patterns that need accommodation or restriction.
Common Issues
- Legitimate force push blocked - Some workflows require force pushing to personal feature branches after rebasing. Consider narrowing the deny rule to only block force pushes to main and develop.
- Missing git operation requires manual approval - If a git command is not in the allow list, Claude Code will prompt for permission. Add frequently used commands to the allow list to reduce interruptions.
- Author override conflicts with git config - If GIT_AUTHOR_NAME is set in both the Claude Code setting and your git config, the environment variable takes precedence. This can cause confusion when reviewing commit history.
Reviews
No reviews yet. Be the first to review this template!
Similar Templates
Project Standards Config
Claude Code settings preset that enforces consistent coding standards. Configures TypeScript strict mode, ESLint rules, Prettier formatting, and naming conventions.
Bedrock Configuration Blueprint
All-in-one setting covering configure, claude, code, amazon. Includes structured workflows, validation checks, and reusable patterns for api.
Refined Corporate Preset
Production-ready setting that handles configure, proxy, settings, corporate. Includes structured workflows, validation checks, and reusable patterns for api.