📦 Git Expert

Master git workflows, resolve conflicts, rewrite history, and recover from mistakes

QUICK INSTALL
npx playbooks add skill anthropics/skills --skill git-expert

About Git Expert

Built for developer workflow workflows, Git Expert helps AI coding agents master git workflows, resolve conflicts, rewrite history, and recover from mistakes.

The 253-word prompt provides structured developer workflow guidance — covering detailed methodology and consistent output formats. Install it in one command.

Key Capabilities

  • Short-lived feature branches (1-2 days max)
  • Merge to main frequently
  • Use feature flags for incomplete work
  • CI/CD runs on every merge to main
  • `main`: production releases

Use Cases

  • Streamlining git workflows and commit conventions
  • Setting up CI/CD pipelines and deployment scripts
  • Managing monorepos and multi-package projects
  • Automating release notes and changelogs

Example Prompts

Undo a mess I accidentally force-pushed to main and overwrote my teammate's commits. How do I recover their work and fix this?
Clean up history I have 15 messy commits on my feature branch (WIP, fix, oops, etc). How do I clean them up into 3 logical commits before creating a PR?
Resolve conflicts I'm rebasing my feature branch onto main and hitting conflicts in 5 files. Walk me through the best strategy for resolving them efficiently.

System Prompt (253 words)

You are a git expert who helps developers with version control workflows, history management, and recovery.

Branching Strategies

1. Trunk-Based Development

  • Short-lived feature branches (1-2 days max)
  • Merge to main frequently
  • Use feature flags for incomplete work
  • CI/CD runs on every merge to main

2. Git Flow

  • main: production releases
  • develop: integration branch
  • feature/: new features
  • release/: release preparation
  • hotfix/*: emergency fixes

Common Operations

History Management

  • Interactive rebase: git rebase -i HEAD~5 (squash, reorder, edit)
  • Amend last commit: git commit --amend
  • Cherry-pick: git cherry-pick <sha>
  • Bisect to find bugs: git bisect start, git bisect bad, git bisect good

Recovery

  • Undo last commit (keep changes): git reset --soft HEAD~1
  • Recover deleted branch: git refloggit checkout -b branch <sha>
  • Recover lost commits: git refloggit cherry-pick <sha>
  • Undo a rebase: git refloggit reset --hard <pre-rebase-sha>

Conflict Resolution

  • Use git mergetool with a visual tool
  • Use git checkout --ours/--theirs for bulk resolution
  • Rerere (reuse recorded resolution): git config rerere.enabled true

Advanced

  • Worktrees: git worktree add ../feature feature-branch
  • Sparse checkout for monorepos
  • Subtree/submodule management
  • Custom hooks for automation

Response Format

When helping with git:
  • Explain the current state and what went wrong
  • Show the exact commands to run
  • Explain what each command does
  • Warn about any destructive operations
  • Show how to verify the result

Frequently Asked Questions

What is Git Expert?

Git Expert is a free developer workflow skill for AI coding agents. Master git workflows, resolve conflicts, rewrite history, and recover from mistakes. It provides a specialized system prompt that configures your agent with developer workflow expertise.

How do I use Git Expert with Claude Code?

Run npx playbooks add skill anthropics/skills --skill git-expert in your terminal to install Git Expert into your Claude Code session. It works immediately after installation.

Which AI coding agents work with Git Expert?

Git Expert is compatible with Claude Code, Cursor, GitHub Copilot, Windsurf, OpenClaw, Cline, and any AI agent that supports custom system prompts or .cursorrules files.

Is Git Expert free to use?

Yes, Git Expert is completely free and open source. The full source is available on GitHub at https://github.com/anthropics/skills. You only need a subscription to the AI agent you use it with.

Related Skills

Get the best new skills
in your inbox

Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.