E

Easy Git Executor

A command template for utilities workflows. Streamlines development with pre-configured patterns and best practices.

CommandClipticsutilitiesv1.0.0MIT
0 views0 copies

Easy Git Executor

Execute common git workflows as single commands -- commit, push, pull, rebase, and branch management -- with built-in safety checks and branch protection.

When to Use This Command

Run this command when...

  • You want to perform git operations with built-in guardrails preventing force-push to main
  • You need a streamlined workflow for staging, committing, and pushing changes
  • You want Claude to handle the git mechanics while you focus on writing a good commit message

Avoid this command when...

  • You need complex interactive git operations like interactive rebase or cherry-pick
  • You want full manual control over each individual git step

Quick Start

# .claude/commands/easy-git-executor.md --- allowed-tools: ["Bash"] --- Execute the requested git operation with safety checks. Prevent destructive operations on protected branches. Confirm before any force operations.

Example usage:

/easy-git-executor commit "Add user authentication module"
/easy-git-executor push
/easy-git-executor new-branch feature/dark-mode

Example output:

Git: commit
===========
Staged files:
  M  src/auth/login.ts
  M  src/auth/login.test.ts
  A  src/auth/oauth.ts

Committing: "Add user authentication module"
[feature/auth 4a8f2c1] Add user authentication module
 3 files changed, 142 insertions(+), 8 deletions(-)

Core Concepts

ConceptDescription
Safety checksBlocks force-push to main/master and warns on unusually large diffs
Branch protectionPrevents direct commits to branches in the protected list
Smart stagingShows unstaged changes and offers to include them
Operation confirmationConfirms destructive operations before executing them
Git Command --> Safety Check --> Execute
                   |
              Protected? --> BLOCK + warn
                   |
              Destructive? --> Confirm first
                   |
                  OK --> Run git command

Configuration

OptionDefaultDescription
protectedmain,masterBranches where direct commits and force-push are blocked
auto-stagefalseAutomatically stage all changes before committing
sign-commitsfalseGPG-sign all commits
push-after-commitfalseAuto-push immediately after a successful commit
confirm-destructivetruePrompt before force operations

Best Practices

  1. Never force-push to main -- rely on this command's safety checks as an additional guardrail.
  2. Write descriptive commit messages -- the command passes your message directly; make it count.
  3. Review staged files -- always check the staged file list before confirming a commit.
  4. Use feature branches -- create a new branch for each feature or fix to keep main clean.
  5. Pull before pushing -- avoid merge conflicts by pulling the latest remote changes first.

Common Issues

  1. "Cannot commit to protected branch" -- create a feature branch first, then commit your changes there.
  2. Merge conflicts after pull -- resolve conflicts in the affected files, then commit the resolution.
  3. Push rejected by remote -- your local branch is behind the remote. Pull first, resolve any conflicts, then push again.
Community

Reviews

Write a review

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

Similar Templates