Skip to main content
skill CX Codex

git-workflow · bobmatnyc — Claude Code skill: Git patterns and install

A skill that hands your agent ready Git patterns: commits, branches, conflicts, rebase and hooks. Useful whenever version control is in play.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add bobmatnyc/claude-mpm-skills --skill git-workflow -a claude-code
Open on GitHub

What git-workflow does

Everything sits in one file: Conventional Commits format, atomic commits, branching, conflict resolution. The author puts the saving at 120–150 lines of repeated Git guidance per agent.

Inside are command examples for everyday work. Updating a branch with git rebase origin/main or a merge, undoing a commit with git reset --soft HEAD~1, stash, cherry-pick, interactive rebase, git bisect to track down a bug, git blame. Separate sections cover tags, deleting branches, and pre-commit and pre-push hooks that run a linter and tests.

The skill is marked user-invocable: false and disable-model-invocation: true, so you cannot call it yourself — it loads as a reference. There is also a list of things to avoid: committing secrets, generated files, force pushing to shared branches.

What it helps with

  • format commit messages as Conventional Commits
  • split one large commit into atomic changes
  • resolve a rebase conflict and continue the operation
  • find the commit that introduced a bug with bisect
  • set up a pre-commit hook with lint and tests

Example prompts for the agent

  • show me the git-workflow patterns for commit messages
  • how do I undo the last commit but keep the changes?
  • help me resolve this rebase conflict using git-workflow

How to install git-workflow

1Skills CLI (Vercel)

npx skills add bobmatnyc/claude-mpm-skills --skill git-workflow -a claude-code

2Manually: put the files in place

~/.claude/skills/git-workflow/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/git-workflow/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about git-workflow

How do I install git-workflow in Claude?

Run npx skills add bobmatnyc/claude-mpm-skills --skill git-workflow -a claude-code. The skill file lands at ~/.claude/skills/git-workflow/SKILL.md.

What does git-workflow do?

It gives the agent a set of Git patterns: commit format, branching, conflict resolution, stash, cherry-pick, bisect and hooks. It also removes the need to repeat that guidance in every agent's instructions.

Can I invoke git-workflow manually?

No. It carries user-invocable: false and disable-model-invocation: true, so it works as a reference rather than a command.

Source text

SKILL.md · Apache-2.0
---
name: git-workflow
description: Essential Git patterns for effective version control, eliminating redundant Git guidance per agent.
user-invocable: false
disable-model-invocation: true
license: Apache-2.0
compatibility: claude-code
metadata:
  updated_at: 2025-10-30T17:00:00Z
tags: [git, version-control, workflow, best-practices]
progressive_disclosure:
  entry_point:
    summary: "Essential Git patterns for effective version control, eliminating redundant Git guidance per agent."
    when_to_use: "When working with version control, branches, or pull requests."
    quick_start: "1. Review the core concepts below. 2. Apply patterns to your use case. 3. Follow best practices for implementation."
---
# Git Workflow

Essential Git patterns for effective version control. Eliminates ~120-150 lines of redundant Git guidance per agent.

## Commit Best Practices

### Conventional Commits Format

```
<type>(<scope>): <subject>

<body>

<footer>
```

**Types:**
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation only
- `refactor`: Code change that neither fixes bug nor adds feature
- `perf`: Performance improvement
- `test`: Adding or updating tests
- `chore`: Build process, dependencies, tooling

**Examples:**
```bash
feat(auth): add OAuth2 authentication

Implements OAuth2 flow using Google provider.
Includes token refresh and validation.

Closes #123

fix(api): handle null response in user endpoint

Previously crashed when user not found.
Now returns 404 with error message.

perf(db): optimize user query with index

Reduces query time from 500ms to 50ms.
```

### Atomic Commits

```bash
# Good: Each commit does one thing
git commit -m "feat: add user authentication"
git commit -m "test: add auth tests"
git commit -m "docs: update API docs for auth"

# Bad: Multiple unrelated changes
git commit -m "add auth, fix bugs, update docs"
```

## Branching Strategy

### Git Flow (Feature Branches)

```bash
# Create feature branch from main
git checkout main
git pull origin main
git checkout -b feature/user-authentication

# Work on feature with regular commits
git add src/auth.py
git commit -m "feat(auth): implement login endpoint"

# Keep branch updated with main
git checkout main
git pull origin main
git checkout feature/user-authentication
git rebase main  # Or: git merge main

# Push and create PR
git push -u origin feature/user-authentication
```

### Trunk-Based Development

```bash
# Work directly on main with short-lived branches
git checkout main
git pull origin main
git checkout -b fix/null-pointer
# Make small change
git commit -m "fix: handle null in user query"
git push origin fix/null-pointer
# Merge immediately via PR
```

## Common Workflows

### Updating Branch with Latest Changes

```bash
# Option 1: Rebase (cleaner history)
git checkout feature-branch
git fetch origin
git rebase origin/main

# Resolve conflicts if any
git add resolved_file.py
git rebase --continue

# Option 2: Merge (preserves history)
git checkout feature-branch
git merge origin/main
```

### Undoing Changes

```bash
# Undo last commit (keep changes)
git reset --soft HEAD~1

# Undo last commit (discard changes)
git reset --hard HEAD~1

# Undo changes to specific file
git checkout -- file.py

# Revert a commit (creates new commit)
git revert abc123

# Amend last commit
git add forgotten_file.py
git commit --amend --no-edit
```

### Stashing Work

```bash
# Save current work temporarily
git stash

# List stashes
git stash list

# Apply most recent stash
git stash pop

# Apply specific stash
git stash apply stash@{0}

# Create named stash
git stash save "WIP: authentication feature"
```

### Cherry-Picking Commits

```bash
# Apply specific commit from another branch
git cherry-pick abc123

# Cherry-pick multiple commits
git cherry-pick abc123 def456

# Cherry-pick without committing
git cherry-pick -n abc123
```

## Resolving Conflicts

```bash
# When conflicts occur during merge/rebase
# 1. Check conflicted files
git status

# 2. Edit files to resolve conflicts
# Look for conflict markers:
<<<<<<< HEAD
Your changes
=======
Their changes
>>>>>>> branch-name

# 3. Mark as resolved
git add resolved_file.py

# 4. Continue operation
git rebase --continue  # or git merge --continue
```

## Viewing History

```bash
# Compact log
git log --oneline -10

# Graphical log
git log --graph --oneline --all

# Commits by author
git log --author="John Doe"

# Commits affecting specific file
git log -- path/to/file.py

# See changes in commit
git show abc123

# Compare branches
git diff main..feature-branch
```

## Branch Management

```bash
# List branches
git branch -a  # All branches (local + remote)

# Delete local branch
git branch -d feature-branch  # Safe delete (merged only)
git branch -D feature-branch  # Force delete

# Delete remote branch
git push origin --delete feature-branch

# Rename branch
git branch -m old-name new-name

# Track remote branch
git checkout --track origin/feature-branch
```

## Tags

```bash
# Create lightweight tag
git tag v1.0.0

# Create annotated tag (recommended)
git tag -a v1.0.0 -m "Release version 1.0.0"

# Push tags to remote
git push origin v1.0.0
git push origin --tags  # Push all tags

# Checkout tag
git checkout v1.0.0

# Delete tag
git tag -d v1.0.0
git push origin --delete v1.0.0
```

## Advanced Operations

### Interactive Rebase

```bash
# Edit last 3 commits
git rebase -i HEAD~3

# Options in editor:
# pick = use commit
# reword = change commit message
# edit = stop to amend commit
# squash = combine with previous commit
# fixup = like squash but discard message
# drop = remove commit
```

### Bisect (Find Bug Introduction)

```bash
# Start bisect
git bisect start
git bisect bad  # Current version has bug
git bisect good v1.0.0  # This version was good

# Git checks out middle commit
# Test if bug exists
git bisect bad  # if bug exists
git bisect good  # if bug doesn't exist

# Git narrows down until finding first bad commit
git bisect reset  # Return to original branch
```

### Blame (Find Who Changed Line)

```bash
# See who last modified each line
git blame file.py

# Ignore whitespace changes
git blame -w file.py

# Show specific line range
git blame -L 10,20 file.py
```

## Git Hooks

```bash
# Pre-commit hook (runs before commit)
# .git/hooks/pre-commit
#!/bin/bash
npm run lint
npm test

# Pre-push hook (runs before push)
# .git/hooks/pre-push
#!/bin/bash
npm run test:integration
```

## Best Practices

### ✅ DO

- Commit frequently with atomic changes
- Write clear, descriptive commit messages
- Pull before push to avoid conflicts
- Review changes before committing (`git diff --staged`)
- Use branches for features and fixes
- Keep commits small and focused

### ❌ DON'T

- Commit sensitive data (use `.gitignore`)
- Commit generated files (build artifacts, `node_modules`)
- Force push to shared branches (`git push --force`)
- Commit work-in-progress to main
- Include multiple unrelated changes in one commit
- Rewrite public history

## .gitignore Patterns

```gitignore
# Dependencies
node_modules/
venv/
__pycache__/

# Build outputs
dist/
build/
*.pyc
*.o
*.exe

# IDE
.vscode/
.idea/
*.swp

# Secrets
.env
*.key
*.pem
secrets.yml

# OS
.DS_Store
Thumbs.db

# Logs
*.log
logs/
```

## Quick Command Reference

```bash
# Status and diff
git status
git diff
git diff --staged

# Commit
git add .
git commit -m "message"
git push

# Branch
git branch
git checkout -b branch-name
git merge branch-name

# Update
git pull
git fetch

# Undo
git reset HEAD~1
git checkout -- file
git revert commit-hash

# History
git log
git log --oneline
git show commit-hash
```

## Remember

- **Commit often** - Small commits are easier to review and revert
- **Descriptive messages** - Future you will thank present you
- **Pull before push** - Stay synchronized with team
- **Use branches** - Keep main stable
- **Review before commit** - Check what is being committed

© bobmatnyc · Apache-2.0 · bobmatnyc/claude-mpm-skills

Similar skills

All skills for Git and GitHub →

git-workflow by other authors comes first.

git-workflow affaan-m A skill that hands your agent Git conventions: which branching strategy to pick, how to word commits, and when rebase beats merge. CX Codex +1 5,000installs git-workflow agno-team A skill that enforces best practices for commits, branch names, and pull requests. Includes commit message validation, branch naming templates, and PR checklist structure — useful if your team has git standards. CX Codex +1 665installs git-workflow ruvnet A skill that walks branches, conflicts and the pull request lifecycle, with a diff-risk score before every merge. CX Codex +1 743installs git-workflow Galaxy-Dawn Enforces Git standards: Conventional Commits, branch naming, no-ff merge flows, and conflict resolution. Useful for teams needing consistent version control habits. CX Codex +1 374installs git-workflow jezweb Guides Git work for pull requests, merged-branch cleanup, conflict resolution, and monorepo release tags in Claude Code. CX Codex +1 1,200installs git-workflow-and-versioning addyosmani A skill that tells your agent how to use git: atomic commits, short-lived branches, worktrees for parallel tasks. Useful when AI writes code faster than you can review it. CX Codex +1 59,500installs git-notes NeoLabHQ Attaches notes to commits without touching their SHA. Useful for marking reviews, test results or adding context after the fact. CX Codex +1 1,100installs here-be-git intellectronica Runs git init in the current folder, optionally adds agent commit rules to AGENTS.md, and writes a .gitignore. CX Codex +1 527installs git-worktree-explorer official James Montemagno This plugin visualizes an active Git repository through worktrees, branches, and commits. Use it when you need a clear view of repository structure and pull request context. ★ 40,418repo stars git-workflow-strategy aj-geddes A skill that helps your agent pick a branching model and walk a feature, release or hotfix through the right steps. Useful when the team has no shared branch rules. CX Codex +1 482installs Git Workflow taste f A prompt that gives an AI assistant trunk-based habits: short-lived branches, Conventional Commits, squash-merge and a protected main. GP ChatGPT ★ 174,597repo stars

From the same set65

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor