git-advanced-workflows

Manage Git history with interactive rebase, cherry-pick, bisect, worktrees, and reflog recovery.

Updated May 28, 2026
One-click install
npx skills add https://github.com/changfengpro/agent-skills --skill git-advanced-workflows-changfengpro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-advanced-workflows
Source: https://github.com/changfengpro/agent-skills/tree/main/skills/git-advanced-workflows
Command: npx skills add https://github.com/changfengpro/agent-skills --skill git-advanced-workflows-changfengpro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Complex Git operations like rewriting history, finding bug-introducing commits, and recovering lost work are error-prone and risky without clear guidance, often leading to lost commits or broken shared branches. ## Core Features & Use Cases - History Editing: Clean up commits with interactive rebase, squash, fixup, and autosquash before opening pull requests. - Targeted Commit Operations: Cherry-pick specific commits across release branches and use bisect to binary-search for the commit that introduced a bug. - Parallel Work & Recovery: Use worktrees to work on multiple branches simultaneously and reflog to recover deleted branches or lost commits. - Use Case: You need to apply a critical security fix from main to two release branches while keeping your feature branch history clean for review—cherry-pick the fix, then interactively rebase and force-push with --force-with-lease. ## Quick Start Ask the assistant to help you clean up the last five commits on your feature branch with an interactive rebase before opening a pull request.

Frequently Asked Questions about git-advanced-workflows

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I clean up commits before a pull request with git rebase?

Run git rebase -i with the merge base of your branch, then use squash, fixup, reword, or drop to reorganize commits. Afterward, push with git push --force-with-lease to safely update the remote branch.

How do I find which commit introduced a bug in Git?

Use git bisect: mark a bad commit and a known good commit, then Git checks out middle commits for you to test. You can automate it with git bisect run followed by a test script that exits 0 for good and non-zero for bad.

When should I use git rebase vs git merge?

Rebase is best for cleaning up local commits and keeping a feature branch current with main, producing linear history. Merge is better for integrating completed features and for public branches shared with others, since rebasing shared history causes conflicts.

How do I recover a deleted branch or lost commit in Git?

Use git reflog to view recent ref movements and find the lost commit hash, then run git branch recovered-branch <hash> or git reset --hard <hash>. Reflog retains entries for about 90 days, making it a reliable safety net.

What are git worktrees and when should I use them?

Git worktrees let you check out multiple branches in separate directories simultaneously, avoiding stashing or switching. Use git worktree add for urgent hotfixes while continuing feature work, and remove them with git worktree remove when done.

Why is git push --force dangerous and what is the safer alternative?

Plain --force can overwrite teammates' commits on shared branches without warning. Use --force-with-lease instead, which fails the push if the remote branch has been updated by someone else since your last fetch.