Back to Skills

git-workflow

verified

How Claude Code handles git commits and pull requests, including git safety protocols and best practices. Use when user asks about creating commits, making PRs, git workflows, or git safety.

View on GitHub

Marketplace

claude-plugins

reggiechan74/claude-plugins

Plugin

claude-code-metaskill

Repository

reggiechan74/claude-plugins

plugins/claude-code-metaskill/skills/git-workflow/SKILL.md

Last Verified

January 21, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/reggiechan74/claude-plugins/blob/main/plugins/claude-code-metaskill/skills/git-workflow/SKILL.md -a claude-code --skill git-workflow

Installation paths:

Claude
.claude/skills/git-workflow/
Powered by add-skill CLI

Instructions

# Git Workflow in Claude Code

## Overview

Claude Code provides intelligent git workflow automation with built-in safety protocols. It can create commits, generate pull requests, and manage git operations while following best practices and security guidelines.

## Git Safety Protocol

**NEVER:**
- Update the git config
- Run destructive/irreversible git commands (like push --force, hard reset, etc.) unless explicitly requested
- Skip hooks (--no-verify, --no-gpg-sign, etc.) unless explicitly requested
- Run force push to main/master (warn the user if they request it)
- Commit changes unless the user explicitly asks

**Avoid git commit --amend** - ONLY use --amend when either:
1. User explicitly requested amend OR
2. Adding edits from pre-commit hook

**Before amending:**
- ALWAYS check authorship: `git log -1 --format='%an %ae'`
- NEVER amend other developers' commits

## Creating Commits

### When to Commit
Only create commits when the user explicitly requests them. It is VERY IMPORTANT to only commit when explicitly asked, otherwise the user will feel that you are being too proactive.

### Commit Workflow

**Step 1 - Gather Information (in parallel):**
Run these bash commands simultaneously:
- `git status` - see all untracked files
- `git diff` - see both staged and unstaged changes
- `git log` - see recent commit messages to follow the repository's commit message style

**Step 2 - Analyze and Draft:**
- Summarize the nature of changes (new feature, enhancement, bug fix, refactoring, test, docs, etc.)
- Do not commit files that likely contain secrets (.env, credentials.json, etc.)
- Warn the user if they specifically request to commit those files
- Draft a concise (1-2 sentences) commit message that focuses on the "why" rather than the "what"
- Ensure it accurately reflects the changes and their purpose

**Step 3 - Execute Commit (sequentially):**
Add relevant untracked files to the staging area, then create the commit with a message ending with:

```
🤖 Generate

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
5693 chars