New to Claude Skills? Learn how to install them →

wshobson on GitHub

Git Advanced Workflows

Free

Master complex Git techniques for clean history and collaboration.

by wshobson38.7k stars on wshobson/agents
2 views
Updated Jul 18, 2026
Get this skill

Free · Opens the source repo

What Git Advanced Workflows does

Git Advanced Workflows is designed for developers and teams looking to enhance their Git skills, particularly in managing intricate histories and workflows. This skill focuses on advanced techniques such as interactive rebasing, cherry-picking, and using Git bisect to streamline collaboration and maintain a clean project history. By mastering these workflows, users can confidently navigate complex branching scenarios and recover from mistakes, ensuring that their version control practices are both efficient and effective.

The skill covers essential operations like interactive rebase, which allows users to edit commit history with precision, and cherry-picking, enabling the application of specific commits across branches without merging entire histories. Additionally, Git bisect provides a systematic approach to identifying problematic commits, making it easier to troubleshoot issues that arise during development. Worktrees facilitate simultaneous work on multiple branches, eliminating the need for constant context switching and stashing.

This skill is particularly useful for teams collaborating on feature branches, as it helps in preparing clean pull requests and synchronizing diverged branches. The emphasis on best practices, such as using --force-with-lease and creating backup branches before risky operations, ensures that users can manage their repositories safely and avoid common pitfalls.

Overall, Git Advanced Workflows is an invaluable resource for developers seeking to deepen their understanding of Git and improve their workflow efficiency. It is suitable for both individual contributors and teams who need to maintain a high level of collaboration and code quality in their projects.

When to use it

Use this skill when you need to clean up commit history, recover from mistakes, or manage complex branching workflows in Git.

When not to use it

This skill may not be suitable for beginners who are still learning the basics of Git or for simple projects that do not require advanced version control techniques.

What you can build with it

Cleaning Up Commit History

Before merging a feature branch, use interactive rebase to tidy up your commit history, making it easier for reviewers to understand your changes.

Identifying Bug Introductions

When a bug is introduced, leverage Git bisect to efficiently locate the commit that caused the issue, saving time during troubleshooting.

Simultaneous Feature Development

Utilize worktrees to manage multiple feature branches at once, allowing for efficient parallel development without losing context.

How to install Git Advanced Workflows

View source

1. Install with the skills CLI

npx skills add wshobson/agents/git-advanced-workflows --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by wshobson

Git Advanced Workflows

Master advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.

When to Use This Skill

  • Cleaning up commit history before merging
  • Applying specific commits across branches
  • Finding commits that introduced bugs
  • Working on multiple features simultaneously
  • Recovering from Git mistakes or lost commits
  • Managing complex branch workflows
  • Preparing clean PRs for review
  • Synchronizing diverged branches

Core Concepts

1. Interactive Rebase

Interactive rebase is the Swiss Army knife of Git history editing.

Common Operations:

  • pick: Keep commit as-is
  • reword: Change commit message
  • edit: Amend commit content
  • squash: Combine with previous commit
  • fixup: Like squash but discard message
  • drop: Remove commit entirely

Basic Usage:

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

# Rebase all commits on current branch
git rebase -i $(git merge-base HEAD main)

# Rebase onto specific commit
git rebase -i abc123

2. Cherry-Picking

Apply specific commits from one branch to another without merging entire branches.

# Cherry-pick single commit
git cherry-pick abc123

# Cherry-pick range of commits (exclusive start)
git cherry-pick abc123..def456

# Cherry-pick without committing (stage changes only)
git cherry-pick -n abc123

# Cherry-pick and edit commit message
git cherry-pick -e abc123

3. Git Bisect

Binary search through commit history to find the commit that introduced a bug.

# Start bisect
git bisect start

# Mark current commit as bad
git bisect bad

# Mark known good commit
git bisect good v1.0.0

# Git will checkout middle commit - test it
# Then mark as good or bad
git bisect good  # or: git bisect bad

# Continue until bug found
# When done
git bisect reset

Automated Bisect:

# Use script to test automatically
git bisect start HEAD v1.0.0
git bisect run ./test.sh

# test.sh should exit 0 for good, 1-127 (except 125) for bad

4. Worktrees

Work on multiple branches simultaneously without stashing or switching.

# List existing worktrees
git worktree list

# Add new worktree for feature branch
git worktree add ../project-feature feature/new-feature

# Add worktree and create new branch
git worktree add -b bugfix/urgent ../project-hotfix main

# Remove worktree
git worktree remove ../project-feature

# Prune stale worktrees
git worktree prune

5. Reflog

Your safety net - tracks all ref movements, even deleted commits.

# View reflog
git reflog

# View reflog for specific branch
git reflog show feature/branch

# Restore deleted commit
git reflog
# Find commit hash
git checkout abc123
git branch recovered-branch

# Restore deleted branch
git reflog
git branch deleted-branch abc123

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Always Use --force-with-lease: Safer than --force, prevents overwriting others' work
  2. Rebase Only Local Commits: Don't rebase commits that have been pushed and shared
  3. Descriptive Commit Messages: Future you will thank present you
  4. Atomic Commits: Each commit should be a single logical change
  5. Test Before Force Push: Ensure history rewrite didn't break anything
  6. Keep Reflog Aware: Remember reflog is your safety net for 90 days
  7. Branch Before Risky Operations: Create backup branch before complex rebases
# Safe force push
git push --force-with-lease origin feature/branch

# Create backup before risky operation
git branch backup-branch
git rebase -i main
# If something goes wrong
git reset --hard backup-branch

Common Pitfalls

  • Rebasing Public Branches: Causes history conflicts for collaborators
  • Force Pushing Without Lease: Can overwrite teammate's work
  • Losing Work in Rebase: Resolve conflicts carefully, test after rebase
  • Forgetting Worktree Cleanup: Orphaned worktrees consume disk space
  • Not Backing Up Before Experiment: Always create safety branch
  • Bisect on Dirty Working Directory: Commit or stash before bisecting

Recovery Commands

# Abort operations in progress
git rebase --abort
git merge --abort
git cherry-pick --abort
git bisect reset

# Restore file to version from specific commit
git restore --source=abc123 path/to/file

# Undo last commit but keep changes
git reset --soft HEAD^

# Undo last commit and discard changes
git reset --hard HEAD^

# Recover deleted branch (within 90 days)
git reflog
git branch recovered-branch abc123

Frequently asked questions about Git Advanced Workflows

Similar skills