R

Refined Git Preset

Powerful setting for configure, commit, behavior, including. Includes structured workflows, validation checks, and reusable patterns for global.

SettingClipticsglobalv1.0.0MIT
0 views0 copies

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

AspectDetails
Force Push ProtectionPrevents accidental force pushes that can destroy team members' work
Hard Reset GuardBlocks git reset --hard to prevent unrecoverable local changes loss
Standard OperationsAllows all common read and write git operations without prompts
Branch DefaultsConfigures 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

ParameterTypeDefaultDescription
permissions.allowarray[]List of git command patterns permitted without interactive confirmation
permissions.denyarray[]List of destructive git command patterns that are blocked entirely
GIT_DEFAULT_BRANCHstring"main"Default branch name for new repositories and merge targets
GIT_AUTHOR_NAMEstringN/AOverride the git author name for commits made through Claude Code
GIT_AUTHOR_EMAILstringN/AOverride the git author email for commits made through Claude Code

Best Practices

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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

  1. 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.
  2. 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.
  3. 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.
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates