Skip to main content
skill CX Codex

git-rebase — Claude Code skill: rebase a branch and resolve conflicts

Walks an agent through a rebase and settles conflicts commit by commit, leaving unrelated work alone. Useful when a branch has fallen behind its base.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add pedronauck/skills --skill git-rebase -a claude-code
Open on GitHub

What git-rebase does

The skill runs in steps. The agent checks status, the current branch and the target, sees whether a rebase is already running, and keeps uncommitted edits where they are. No auto-stash, no reset, no checkout; when the tree is messy, it works in a separate checkout.

Before rewriting anything valuable, the agent notes HEAD and makes a backup ref with scripts/pre-rebase-backup.sh. A plain rebase onto the requested target is the norm. Squashing or reordering happens only on your request, not because the branch has many commits. Each conflict gets its own pass: during a rebase ours means the target plus the commits already replayed, theirs is the one being replayed now. The agent reads the changed APIs instead of taking a side wholesale, so the security and compatibility contracts survive.

Publishing a rewritten branch happens only if you already allowed it, and it goes through --force-with-lease. Should that lease fail, the agent inspects the new remote commits rather than switching to an unconditional force. Merge-commit flows, cherry-picking and repository setup are outside its scope.

What it helps with

  • Move a branch onto a newer base without losing either side
  • Work through a conflict between the replayed commit and earlier ones
  • Take a backup ref before history is rewritten
  • Push a rewritten branch without clobbering others' commits
  • Check the resulting diff and test the affected behaviour

Example prompts for the agent

  • Rebase this branch onto main and handle conflicts one at a time
  • Move feature/auth onto origin/main and keep my uncommitted edits
  • Push the branch after the rebase using --force-with-lease

How to install git-rebase

1Skills CLI (Vercel)

npx skills add pedronauck/skills --skill git-rebase -a claude-code

2Manually: put the files in place

~/.claude/skills/git-rebase/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/git-rebase/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about git-rebase

How do I install git-rebase in Claude Code?

Run npx skills add pedronauck/skills --skill git-rebase -a claude-code. The skill file lands at ~/.claude/skills/git-rebase/SKILL.md.

What does git-rebase do?

It carries out a rebase onto the target you give it and resolves conflicts as commits are replayed, keeping both sides' intent. It also takes a backup ref and checks the final diff.

How is it different from plain git rebase?

The agent tracks which side is ours and which is theirs during replay, then fixes the affected behaviour rather than accepting one side. A rewritten branch is pushed only with your permission, via --force-with-lease.

Similar skills

All skills for Git and GitHub →

From the same set18

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor