git-advanced-workflows
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 (rebase)
- Applying specific commits across branches (cherry-pick)
- Finding commits that introduced bugs (bisect)
- Working on multiple features simultaneously (worktrees)
- Recovering from Git mistakes or lost commits (reflog)
- Synchronizing diverged branches
Workflow
- Context: Are you cleaning history, recovering lost work, or isolating a bug?
- Safety: Always create a backup branch before destructive operations (
git branch backup-before-rebase). - Execute: Use the specific command (rebase -i, bisect, reflog).
- Verify: Check log/tests to ensure integrity.
- Push: If history changed, use
--force-with-lease.
Instructions
1. Interactive Rebase (The History Editor)
Use to squash typos, reword messages, or reorder commits.
git rebase -i HEAD~5
# Commands: pick, reword, edit, squash, fixup, drop
- Autosquash:
git commit --fixup HEAD->git rebase -i --autosquash main.
2. Cherry-Picking (The Sniper)
Apply specific commits to another branch without merging.
git cherry-pick abc1234
git cherry-pick abc1234..def5678 # Range
git cherry-pick -n abc1234 # Stage only (no commit)
3. Git Bisect (The Bug Hunter)
Binary search to find the exact commit that broke something.
git bisect start
git bisect bad # Current is broken
git bisect good v1.0.0 # v1.0.0 was working
# Git checks out middle commit... you test...
git bisect good # or bad
# Repeat until found
git bisect reset
4. Worktrees (The Multitasker)
Check out multiple branches in parallel folders. No more stash/switch ping-pong.
git worktree add ../feature-folder feature/new-stuff
# Work there...
git worktree remove ../feature-folder
5. Reflog (The Time Machine)
Recover "lost" commits after a hard reset or delete.
git reflog
# Find the hash BEFORE you messed up (e.g., abc1234)
git reset --hard abc1234
# Or restore a deleted branch
git branch recovered-branch abc1234
Resources
More from mileycy516-stack/skills
trading-psychology-coach
High-performance mental coach for traders. implementation of "Mental Hand History", A-Game/C-Game mapping, and probabilistic thinking protocols. Use PROACTIVELY to analyze behavior, reduce tilt, and optimize the Human OS.
52frontend-developer
Build React components, implement responsive layouts, and handle client-side state management. Masters React 19, Next.js 15, and modern frontend architecture. Optimizes performance and ensures accessibility.
9vercel-react-best-practices
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
6context-manager
Elite AI context engineering specialist mastering dynamic context management, vector databases, knowledge graphs, and intelligent memory systems. Orchestrates context across multi-agent workflows, enterprise AI systems, and long-running projects.
4design-system-architect
Master design system architecture to create consistent, maintainable, and scalable UI foundations. Establish design tokens, theming hierarchies, type scales, and brand identity codes.
4backend-architect
Expert backend architect specializing in scalable API design, microservices architecture, and distributed systems. Masters REST/GraphQL/gRPC APIs, event-driven architectures, service mesh patterns, and modern backend frameworks.
4