{
    "url": "https://delaparra-services.nl/skills/git-advanced-workflows",
    "locale": "en",
    "title": "Git Advanced Workflows | DeLaParra Services",
    "description": "Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.",
    "alternates": {
        "en": "https://delaparra-services.nl/skills/git-advanced-workflows",
        "nl": "https://delaparra-services.nl/nl/skills/git-advanced-workflows"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/skills/git-advanced-workflows.csv",
        "md": "https://delaparra-services.nl/skills/git-advanced-workflows.md",
        "json": "https://delaparra-services.nl/skills/git-advanced-workflows.json",
        "zip": "https://delaparra-services.nl/skills/git-advanced-workflows.zip",
        "pdf": "https://delaparra-services.nl/skills/git-advanced-workflows.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/skills/git-advanced-workflows.csv",
            "encodingFormat": "text/csv",
            "name": "git-advanced-workflows.csv"
        },
        {
            "url": "https://delaparra-services.nl/skills/git-advanced-workflows.json",
            "encodingFormat": "application/json",
            "name": "git-advanced-workflows.json"
        },
        {
            "url": "https://delaparra-services.nl/skills/git-advanced-workflows.md",
            "encodingFormat": "text/markdown",
            "name": "git-advanced-workflows.md"
        },
        {
            "url": "https://delaparra-services.nl/skills/git-advanced-workflows.pdf",
            "encodingFormat": "application/pdf",
            "name": "git-advanced-workflows.pdf"
        },
        {
            "url": "https://delaparra-services.nl/skills/git-advanced-workflows.zip",
            "encodingFormat": "application/zip",
            "name": "git-advanced-workflows.zip"
        },
        {
            "url": "https://delaparra-services.nl/skills/git-advanced-workflows/download",
            "encodingFormat": "application/zip",
            "name": "git-advanced-workflows-files.zip"
        }
    ],
    "markdown": "# Git Advanced Workflows\n\n \n\nMaster advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.\n\n \n\n**Licence** MIT\n\n \n\n**Source** wshobson/agents\n\n [Download zip](<https://delaparra-services.nl/skills/git-advanced-workflows/download>)   \n\n# Git Advanced Workflows\n\n \n\nMaster advanced Git techniques to maintain clean history, collaborate effectively, and recover from any situation with confidence.\n\n \n\n## When to Use This Skill\n\n \n\n- Cleaning up commit history before merging \n- Applying specific commits across branches \n- Finding commits that introduced bugs \n- Working on multiple features simultaneously \n- Recovering from Git mistakes or lost commits \n- Managing complex branch workflows \n- Preparing clean PRs for review \n- Synchronizing diverged branches\n\n \n\n## Core Concepts\n\n \n\n### 1. Interactive Rebase\n\n \n\nInteractive rebase is the Swiss Army knife of Git history editing.\n\n \n\n**Common Operations:**\n\n \n\n- ` pick `: Keep commit as-is \n- ` reword `: Change commit message \n- ` edit `: Amend commit content \n- ` squash `: Combine with previous commit \n- ` fixup `: Like squash but discard message \n- ` drop `: Remove commit entirely\n\n \n\n**Basic Usage:**\n\n \n\n```\n# Rebase last 5 commits\ngit rebase -i HEAD~5\n\n# Rebase all commits on current branch\ngit rebase -i $(git merge-base HEAD main)\n\n# Rebase onto specific commit\ngit rebase -i abc123\n```\n\n \n\n### 2. Cherry-Picking\n\n \n\nApply specific commits from one branch to another without merging entire branches.\n\n \n\n```\n# Cherry-pick single commit\ngit cherry-pick abc123\n\n# Cherry-pick range of commits (exclusive start)\ngit cherry-pick abc123..def456\n\n# Cherry-pick without committing (stage changes only)\ngit cherry-pick -n abc123\n\n# Cherry-pick and edit commit message\ngit cherry-pick -e abc123\n```\n\n \n\n### 3. Git Bisect\n\n \n\nBinary search through commit history to find the commit that introduced a bug.\n\n \n\n```\n# Start bisect\ngit bisect start\n\n# Mark current commit as bad\ngit bisect bad\n\n# Mark known good commit\ngit bisect good v1.0.0\n\n# Git will checkout middle commit - test it\n# Then mark as good or bad\ngit bisect good  # or: git bisect bad\n\n# Continue until bug found\n# When done\ngit bisect reset\n```\n\n \n\n**Automated Bisect:**\n\n \n\n```\n# Use script to test automatically\ngit bisect start HEAD v1.0.0\ngit bisect run ./test.sh\n\n# test.sh should exit 0 for good, 1-127 (except 125) for bad\n```\n\n \n\n### 4. Worktrees\n\n \n\nWork on multiple branches simultaneously without stashing or switching.\n\n \n\n```\n# List existing worktrees\ngit worktree list\n\n# Add new worktree for feature branch\ngit worktree add ../project-feature feature/new-feature\n\n# Add worktree and create new branch\ngit worktree add -b bugfix/urgent ../project-hotfix main\n\n# Remove worktree\ngit worktree remove ../project-feature\n\n# Prune stale worktrees\ngit worktree prune\n```\n\n \n\n### 5. Reflog\n\n \n\nYour safety net - tracks all ref movements, even deleted commits.\n\n \n\n```\n# View reflog\ngit reflog\n\n# View reflog for specific branch\ngit reflog show feature/branch\n\n# Restore deleted commit\ngit reflog\n# Find commit hash\ngit checkout abc123\ngit branch recovered-branch\n\n# Restore deleted branch\ngit reflog\ngit branch deleted-branch abc123\n```\n\n \n\n## Detailed patterns and worked examples\n\n \n\nDetailed pattern documentation lives in ` references/details.md `. Read that file when the navigation tier above is insufficient.\n\n \n\n## Best Practices\n\n \n\n1. **Always Use --force-with-lease**: Safer than --force, prevents overwriting others' work \n1. **Rebase Only Local Commits**: Don't rebase commits that have been pushed and shared \n1. **Descriptive Commit Messages**: Future you will thank present you \n1. **Atomic Commits**: Each commit should be a single logical change \n1. **Test Before Force Push**: Ensure history rewrite didn't break anything \n1. **Keep Reflog Aware**: Reflog is your safety net, but entries for commits not reachable from the current tip expire after 30 days by default (` gc.reflogExpireUnreachable `), and reachable entries after 90 days (` gc.reflogExpire `) \n1. **Branch Before Risky Operations**: Create backup branch before complex rebases\n\n \n\n```\n# Safe force push\ngit push --force-with-lease origin feature/branch\n\n# Create backup before risky operation\ngit branch backup-branch\ngit rebase -i main\n# If something goes wrong\ngit reset --hard backup-branch\n```\n\n \n\n## Common Pitfalls\n\n \n\n- **Rebasing Public Branches**: Causes history conflicts for collaborators \n- **Force Pushing Without Lease**: Can overwrite teammate's work \n- **Losing Work in Rebase**: Resolve conflicts carefully, test after rebase \n- **Forgetting Worktree Cleanup**: Orphaned worktrees consume disk space \n- **Not Backing Up Before Experiment**: Always create safety branch \n- **Bisect on Dirty Working Directory**: Commit or stash before bisecting\n\n \n\n## Recovery Commands\n\n \n\n```\n# Abort operations in progress\ngit rebase --abort\ngit merge --abort\ngit cherry-pick --abort\ngit bisect reset\n\n# Restore file to version from specific commit\ngit restore --source=abc123 path/to/file\n\n# Undo last commit but keep changes\ngit reset --soft HEAD^\n\n# Undo last commit and discard changes\n# WARNING: --hard also deletes uncommitted changes (staged and unstaged),\n# and the reflog cannot recover them. Check `git status` and stash first.\ngit reset --hard HEAD^\n\n# Recover a deleted branch soon. By default, git gc can prune HEAD's reflog\n# entries for unmerged commits once they're 30 days old, counted from when\n# each entry was recorded, not from the deletion\n# Deleting a branch also deletes its own reflog; search HEAD's reflog\ngit reflog\ngit branch recovered-branch abc123\n```\n\n \n\n## Files\n\n \n\n- ` LICENSE ` \n- ` SKILL.md ` \n- ` SOURCE.md ` \n- ` references/details.md `\n\n \n\n## Related terms\n\n \n\n- [Git](<https://delaparra-services.nl/knowledge-hub/git>) \n- [git add](<https://delaparra-services.nl/knowledge-hub/git-add>) \n- [git bisect](<https://delaparra-services.nl/knowledge-hub/git-bisect>) \n- [git branch](<https://delaparra-services.nl/knowledge-hub/git-branch>) \n- [git checkout](<https://delaparra-services.nl/knowledge-hub/git-checkout>) \n- [git cherry-pick](<https://delaparra-services.nl/knowledge-hub/git-cherry-pick>) \n- [git clone](<https://delaparra-services.nl/knowledge-hub/git-clone>) \n- [git commit](<https://delaparra-services.nl/knowledge-hub/git-commit>) \n- [git config](<https://delaparra-services.nl/knowledge-hub/git-config>) \n- [git diff](<https://delaparra-services.nl/knowledge-hub/git-diff>) \n- [git fetch](<https://delaparra-services.nl/knowledge-hub/git-fetch>) \n- [git init](<https://delaparra-services.nl/knowledge-hub/git-init>) \n- [git log](<https://delaparra-services.nl/knowledge-hub/git-log>) \n- [git merge](<https://delaparra-services.nl/knowledge-hub/git-merge>) \n- [git rebase](<https://delaparra-services.nl/knowledge-hub/git-rebase>) \n- [git remote](<https://delaparra-services.nl/knowledge-hub/git-remote>) \n- [git reset](<https://delaparra-services.nl/knowledge-hub/git-reset>) \n- [git restore](<https://delaparra-services.nl/knowledge-hub/git-restore>) \n- [git revert](<https://delaparra-services.nl/knowledge-hub/git-revert>) \n- [git stash](<https://delaparra-services.nl/knowledge-hub/git-stash>) \n- [git status](<https://delaparra-services.nl/knowledge-hub/git-status>) \n- [git switch](<https://delaparra-services.nl/knowledge-hub/git-switch>) \n- [git tag](<https://delaparra-services.nl/knowledge-hub/git-tag>) \n- [Version control](<https://delaparra-services.nl/knowledge-hub/version-control>)\n\n \n\n[Installing an agent skill in Claude Code, Codex, Cursor and Copilot](<https://delaparra-services.nl/manuals/een-skill-installeren-in-je-ai-assistent>)\n\n[HTML version](https://delaparra-services.nl/skills/git-advanced-workflows)\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Organization",
                "@id": "https://delaparra-services.nl/#practice",
                "logo": "https://delaparra-services.nl/logo.png",
                "name": "DeLaParra Services",
                "legalName": "DeLaParra Services",
                "url": "https://delaparra-services.nl/",
                "description": "Bespoke software, web applications and mobile apps, developed in Laravel by a single developer in Groningen. Fixed price agreed in advance, full source code provided upon delivery.",
                "email": "info@delaparra-services.nl",
                "address": {
                    "@type": "PostalAddress",
                    "addressLocality": "Groningen",
                    "addressRegion": "Groningen",
                    "addressCountry": "NL"
                },
                "areaServed": "Groningen, the Netherlands",
                "knowsLanguage": [
                    "en",
                    "nl"
                ],
                "knowsAbout": [
                    "Web design and development",
                    "App development",
                    "Custom software and web applications",
                    "OpenSpec",
                    "AI code review",
                    "Your own coding agent"
                ],
                "founder": {
                    "@id": "https://delaparra-services.nl/#person"
                }
            },
            {
                "@type": "WebPage",
                "@id": "https://delaparra-services.nl/skills/git-advanced-workflows#webpage",
                "url": "https://delaparra-services.nl/skills/git-advanced-workflows",
                "name": "Git Advanced Workflows | DeLaParra Services",
                "description": "Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/skills/git-advanced-workflows#breadcrumb"
                }
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/skills/git-advanced-workflows#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Git Advanced Workflows"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "SoftwareSourceCode",
                "@id": "https://delaparra-services.nl/skills/git-advanced-workflows#skill",
                "url": "https://delaparra-services.nl/skills/git-advanced-workflows",
                "name": "Git Advanced Workflows",
                "description": "Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.",
                "inLanguage": "en",
                "license": "https://spdx.org/licenses/MIT.html",
                "subjectOf": {
                    "@id": "https://delaparra-services.nl/skills/git-advanced-workflows#dataset"
                }
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/skills/git-advanced-workflows#dataset",
                "name": "Git Advanced Workflows",
                "description": "Master advanced Git workflows including rebasing, cherry-picking, bisect, worktrees, and reflog to maintain clean history and recover from any situation. Use when managing complex Git histories, collaborating on feature branches, or troubleshooting repository issues.",
                "url": "https://delaparra-services.nl/skills/git-advanced-workflows",
                "identifier": "https://delaparra-services.nl/skills/git-advanced-workflows#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/skills/git-advanced-workflows#skill"
                },
                "creditText": "wshobson/agents",
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://spdx.org/licenses/MIT.html",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "dateModified": "2026-11-28T15:33:12+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#skills",
                    "name": "Skills for AI coding assistants",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "git-advanced-workflows.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/skills/git-advanced-workflows.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T15:33:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "git-advanced-workflows.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/skills/git-advanced-workflows.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T15:33:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "git-advanced-workflows.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/skills/git-advanced-workflows.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T15:33:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "git-advanced-workflows.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/skills/git-advanced-workflows.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T15:33:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "git-advanced-workflows.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/skills/git-advanced-workflows.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T15:33:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "git-advanced-workflows-files.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/skills/git-advanced-workflows/download",
                        "inLanguage": "en",
                        "dateModified": "2026-11-28T15:33:12+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    }
                ]
            }
        ]
    }
}