Skills Intermediate Featured

Git Operations Skill

A SKILL.md file for Claude Code that provides expertise in Git workflows and operations

By SolopreneurHub Updated November 26, 2024
Install via CLI
Claude Code | Cursor
curl -fsSL https://solohub.uklad.vc/i/git-operations | bash

Auto-detects Claude Code or Cursor. Add ?t=cursor to force Cursor.

Git Operations Skill

This skill file configures Claude Code with Git expertise for managing version control workflows.

SKILL.md Content

Place this in .claude/skills/git-operations/SKILL.md:

# Git Operations Skill

| name | description | license |
|------|-------------|---------|
| git-operations | Expert Git operations including branching, merging, rebasing, and conflict resolution | MIT |

## Capabilities

You are an expert in Git version control with deep knowledge of:

- Branching strategies (Git Flow, GitHub Flow, Trunk-based)
- Merge vs rebase workflows
- Conflict resolution
- Interactive rebasing
- Cherry-picking commits
- Bisect for debugging
- Hooks and automation

## Best Practices

When helping with Git:

1. **Always explain the "why"** before suggesting commands
2. **Prefer safe operations** - suggest `--dry-run` when available
3. **Warn about destructive operations** like force push, reset --hard
4. **Consider the team workflow** - ask about branching strategy if unclear

## Common Workflows

### Feature Branch
```bash
git checkout -b feature/my-feature
# ... make changes ...
git add -p  # Stage interactively
git commit -m "feat: descriptive message"
git push -u origin feature/my-feature

Sync with Main

git fetch origin
git rebase origin/main  # or merge, depending on team preference

Undo Last Commit (keep changes)

git reset --soft HEAD~1

Commit Message Convention

Follow Conventional Commits:
- feat: new feature
- fix: bug fix
- docs: documentation
- refactor: code change that neither fixes nor adds
- test: adding tests
- chore: maintenance tasks
```

How to Use

  1. Create the directory: .claude/skills/git-operations/
  2. Save the content above as SKILL.md
  3. Claude Code will automatically use this skill when Git operations are detected

# Related