Claude Code Plugins

Community-maintained marketplace

Feedback

Expert git workflow management. Use when working with git operations, branching, merging, resolving conflicts, or managing commits.

Install Skill

1Download skill
2Enable skills in Claude

Open claude.ai/settings/capabilities and find the "Skills" section

3Upload to Claude

Click "Upload skill" and select the downloaded ZIP file

Note: Please verify skill by going through its instructions before using it.

SKILL.md

name git-workflow
description Expert git workflow management. Use when working with git operations, branching, merging, resolving conflicts, or managing commits.
allowed-tools Bash, Read, Grep

Git Workflow Skill

Expert knowledge and best practices for git operations, branching strategies, and version control workflows.

Common Git Operations

Creating Feature Branches

# Create and switch to new branch
git checkout -b feature/description

# Naming conventions
# - feature/add-user-auth
# - fix/login-validation-bug
# - refactor/api-service
# - docs/update-readme

Committing Changes

# Stage specific files
git add file1.ts file2.ts

# Stage all changes
git add .

# Commit with message
git commit -m "feat(auth): add password reset functionality"

# Amend last commit (if not pushed)
git commit --amend -m "Updated message"

Conventional Commits

Format: type(scope): message

Types:

  • feat: New feature
  • fix: Bug fix
  • docs: Documentation changes
  • style: Code style (formatting, missing semicolons)
  • refactor: Code refactoring
  • test: Adding or updating tests
  • chore: Build process, dependencies, tooling

Examples:

feat(api): add user profile endpoint
fix(auth): handle expired token gracefully
docs(readme): update installation instructions
refactor(services): extract common validation logic
test(user): add edge case tests for email validation

Viewing History and Changes

# View commit history
git log --oneline -10

# View changes in a file
git log -p filename.ts

# See what changed in a commit
git show commit-hash

# View current changes
git diff

# View staged changes
git diff --cached

# Compare branches
git diff main..feature-branch

Working with Remote

# Fetch latest from remote
git fetch origin

# Pull changes from remote
git pull origin main

# Push to remote
git push origin branch-name

# Push and set upstream
git push -u origin branch-name

# Force push (use carefully!)
git push --force-with-lease origin branch-name

Branch Management

# List all branches
git branch -a

# Switch to existing branch
git checkout branch-name

# Delete local branch
git branch -d branch-name

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

# Rename current branch
git branch -m new-name

Stashing Changes

# Stash current changes
git stash

# Stash with message
git stash save "WIP: working on feature X"

# List stashes
git stash list

# Apply most recent stash
git stash apply

# Apply and remove stash
git stash pop

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

# Clear all stashes
git stash clear

Resolving Merge Conflicts

# Start merge
git merge feature-branch

# If conflicts occur:
# 1. Open conflicted files
# 2. Look for conflict markers:
#    <<<<<<< HEAD
#    Your changes
#    =======
#    Their changes
#    >>>>>>> branch-name
# 3. Edit to resolve conflicts
# 4. Remove conflict markers
# 5. Stage resolved files
git add conflicted-file.ts

# Complete merge
git commit

Undoing Changes

# Discard changes in working directory
git checkout -- filename.ts

# Unstage file
git reset HEAD filename.ts

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

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

# Revert a specific commit (creates new commit)
git revert commit-hash

# Interactive rebase (rewrite history)
git rebase -i HEAD~3

Cherry-picking

# Apply a specific commit from another branch
git cherry-pick commit-hash

# Cherry-pick without committing
git cherry-pick -n commit-hash

Branching Strategies

Git Flow

main (production)
  ├── develop (integration)
  │   ├── feature/user-auth
  │   ├── feature/payment
  │   └── feature/notifications
  ├── release/v1.2.0
  └── hotfix/critical-bug

Trunk-Based Development

main (always deployable)
  ├── feature/short-lived-branch-1
  └── feature/short-lived-branch-2

Best Practices

Before Committing

  1. Review your changes: git diff
  2. Stage only related changes
  3. Write clear commit messages
  4. Run tests locally
  5. Check linter/formatter

Before Pushing

  1. Pull latest changes: git pull --rebase origin main
  2. Resolve any conflicts
  3. Run full test suite
  4. Ensure CI will pass

Working with Teams

  1. Keep branches up to date with main
  2. Make small, focused commits
  3. Use descriptive branch names
  4. Delete branches after merging
  5. Never force push to shared branches (unless you know what you're doing)

Commit Size

  • Small, atomic commits are better
  • Each commit should be a logical unit
  • Should pass tests independently
  • Easy to review and revert if needed

Troubleshooting

Accidentally Committed to Wrong Branch

# On wrong branch, stash the commit
git reset --soft HEAD~1
git stash

# Switch to correct branch
git checkout correct-branch

# Apply the stashed commit
git stash pop
git commit -m "Your message"

Accidentally Committed Secrets

# Remove from history (use with caution!)
git filter-branch --force --index-filter \
  "git rm --cached --ignore-unmatch path/to/secret/file" \
  --prune-empty --tag-name-filter cat -- --all

# Or use BFG Repo-Cleaner (recommended)
bfg --delete-files secrets.env
git reflog expire --expire=now --all
git gc --prune=now --aggressive

Merge Conflicts During Rebase

# Resolve conflicts in files
# Then continue rebase
git add resolved-file.ts
git rebase --continue

# Or abort rebase
git rebase --abort

Advanced Operations

Interactive Rebase

# Rebase last 3 commits
git rebase -i HEAD~3

# In editor, you can:
# - pick: keep commit
# - reword: change commit message
# - edit: modify commit
# - squash: combine with previous commit
# - fixup: squash without editing message
# - drop: remove commit

Bisect (Find Bug Introduction)

# Start bisect
git bisect start

# Mark current as bad
git bisect bad

# Mark known good commit
git bisect good commit-hash

# Git checks out middle commit, test it
# Then mark as good or bad
git bisect good  # or git bisect bad

# Continue until bug is found
# When done
git bisect reset

Submodules

# Add submodule
git submodule add https://github.com/user/repo path/to/submodule

# Clone repo with submodules
git clone --recursive https://github.com/user/repo

# Update submodules
git submodule update --init --recursive

# Pull latest for all submodules
git submodule update --remote

Useful Aliases

Add to ~/.gitconfig:

[alias]
  st = status
  co = checkout
  br = branch
  ci = commit
  unstage = reset HEAD --
  last = log -1 HEAD
  visual = log --graph --oneline --all
  amend = commit --amend --no-edit

Safety Tips

  1. Never rewrite public history (commits that have been pushed)
  2. Use --force-with-lease instead of --force when you must force push
  3. Backup before dangerous operations: git branch backup-branch
  4. Test rebases locally before pushing
  5. Keep commits atomic and reversible
  6. Communicate with team before force pushing to shared branches

When to Ask for Help

When you need to:

  • Perform complex git operations on a project
  • Resolve merge conflicts
  • Understand git history
  • Set up branching strategy
  • Recover from git mistakes
  • Optimize git workflow

Simply mention git operations or issues, and I'll apply this knowledge to help you.