Skip to content

Guide · Agent skill

How to use the Git Advanced Workflows agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The git-advanced-workflows skill is a set of instructions that teaches an AI agent how to handle advanced Git tasks: interactive rebase, cherry-picking, bisect, worktrees and reflog. It is for developers who already know some Git and want help tidying a branch, recovering lost work or tracking down when a bug was introduced. After this guide you will know how to install the skill, how to ask for help in plain language, and which safety practices the skill asks the agent to follow.

Git Advanced Workflowswshobson/agents · MIT

Quick start

  1. 1Install the skill. Download the ZIP from this page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder, or upload it under Settings → Capabilities → Skills.
  2. 2Confirm Git and a repository. Make sure Git runs on your command line and that you are inside a local repository.
  3. 3Create a backup branch. Before any rewrite, run git branch backup-branch so you can reset if something goes wrong.
  4. 4Describe your task. Ask in plain words, such as cleaning up a branch, copying a commit or finding a bug, and name the branch or commit if you know it.
  5. 5Review the plan. Ask the agent to explain each command before it runs, especially any rebase or force push.
  6. 6Verify and push safely. Test the result, then use git push --force-with-lease only if no one else is using the branch.

What an agent skill is and what this one does

An agent skill is a folder containing a SKILL.md file and supporting reference files. When installed, the agent reads the skill when your request matches its description, and then follows its guidance. This skill covers rebasing, cherry-picking, bisect, worktrees and reflog.

It works mainly by giving the agent step-by-step command patterns and safety practices. For example, it recommends creating a backup branch before a risky rebase and using --force-with-lease instead of --force when pushing a rewritten branch.

  • Clean up commit history before merging or opening a pull request
  • Copy specific commits between branches
  • Find the commit that introduced a bug using bisect
  • Work on several branches at once with worktrees
  • Recover lost commits or deleted branches using the reflog

Install the git-advanced-workflows skill

Download the ZIP for this skill from this page and unzip it. The folder contains SKILL.md and references/details.md. Put the unzipped folder in one of two places: ~/.claude/skills/ to make it available to you across projects, or a project's .claude/skills/ folder to share it with that project only.

Alternatively, in the Claude apps, open Settings, then Capabilities, then Skills, and upload the skill there.

  • Personal install: ~/.claude/skills/
  • Project install: .claude/skills/ inside your repository
  • Claude apps: Settings → Capabilities → Skills, then upload

Check the requirements

You need Git installed on the command line and a local Git repository for the agent to work in. The skill does not run scripts and does not use the network, so it only guides the agent's Git commands.

  • Git installed on the command line
  • A local Git repository

Trigger the skill with natural requests

You do not need to name the skill. Describe the task in plain words that match its purpose, such as cleaning up history, finding a bug's origin, or recovering a lost commit. Mention the branch or commit when you know it, and say whether the branch has been pushed, because that changes what is safe.

The skill's guidance is most useful when you ask for a plan first. You can ask the agent to explain each command before it runs it.

  • "Clean up the commits on feature/user-auth before I open a PR."
  • "Copy commit abc123 onto release/2.0 and tell me about any conflicts."
  • "Find which commit introduced this bug. The v1.0.0 tag was working."
  • "I deleted a branch by accident. Help me recover it from the reflog."

Example: squash and reword before a pull request

The skill's first workflow starts from a feature branch, runs an interactive rebase against main to squash small fix commits and reword unclear messages, then pushes with a lease check. Interactive rebase supports pick, reword, edit, squash, fixup and drop operations.

Only do this on a branch nobody else is using. The source says force pushing is safe only if no one else is using the branch.

git checkout feature/user-auth git rebase -i main git push --force-with-lease origin feature/user-auth

Example: find a bug with bisect

Bisect performs a binary search through history. You mark a known bad commit and a known good one, Git checks out a middle commit, and you test it and mark it good or bad until the culprit is found. If your test can be run as a script, bisect can run it automatically. The script should exit 0 for good and 1 through 127, except 125, for bad.

The source warns that bisect should not be run on a dirty working directory, so commit or stash your changes first.

git bisect start git bisect bad git bisect good v1.0.0 # test, then mark each checkout good or bad git bisect reset

Safety practices to follow

Create a backup branch before a complex rebase. If something goes wrong, you can reset to it. Rebase only commits that have not been pushed and shared. Test after a rewrite before force pushing.

Be careful with git reset --hard. It also deletes uncommitted changes, and the reflog cannot recover them, so check git status and stash first. Reflog entries expire, so recover sooner rather than later.

  • Always create a backup branch before a risky operation
  • Use --force-with-lease, not --force
  • Do not rebase branches that others have pulled
  • Use git rebase --abort, git merge --abort or git cherry-pick --abort to back out of an operation in progress
git branch backup-branch git rebase -i main # If something goes wrong git reset --hard backup-branch

What people use it for

  • Squashing fix-typo commits into meaningful ones before a pull request
  • Applying a security patch from main to several release branches with cherry-pick
  • Using bisect with a test script to find the commit that broke a feature
  • Running two branches side by side with a worktree instead of stashing
  • Recovering a deleted branch or an overwritten commit from the reflog

Frequently asked questions

How do I install the git-advanced-workflows skill?

Download the ZIP from this page and unzip it into ~/.claude/skills/ for personal use, or into a project's .claude/skills/ folder to share it with that project. In the Claude apps, you can instead upload it under Settings → Capabilities → Skills.

What do I need to use it?

You need Git installed on the command line and a local Git repository. The skill does not run scripts and does not use the network.

Is this skill free?

The skill is published under the MIT licence. The source does not mention pricing, so check the listing on this page for any other terms.

Can I use it to recover lost commits?

Yes. The skill covers the reflog and shows how to find a commit hash and create a branch from it, for example to recover a deleted branch. It also warns that reflog entries expire, so act sooner rather than later.

Is it safe to rebase with this skill?

It is safe on local commits that nobody else has pulled. The skill advises against rebasing shared branches, creating a backup branch first, and using --force-with-lease instead of --force.

Who should not use this skill?

Beginners who do not yet understand Git should learn the basics first, because rewriting history can lose work if misused. Teams should also avoid rebasing shared or already-pushed branches, since that can break collaborators' work.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

Use this skill if you already know Git and want clear, safety-minded guidance for rebasing, cherry-picking, bisect, worktrees and reflog recovery. Pick something else if you are new to Git or need to rewrite branches that others depend on, since the skill assumes working knowledge and cannot protect shared history for you.

Download the skill