Skip to content
Back to skills

Rebase

ASecurity

Clean up branch history with interactive rebase without rewriting shared commits

  • 3 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 3, 2026
ai-agentsgogit

Security analysis

A100/100

Scanned September 3, 2026

npx -y skills add black141312/ada --skill rebase --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Rebase?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Rebase
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/black141312-rebase/badge)](https://www.skillsdirectory.com/skills/black141312-rebase)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: rebase
description: Clean up branch history with interactive rebase without rewriting shared commits
category: git
---

# Rebase

Use this to tidy a feature branch's history — reorder, reword, fixup, or drop commits, or replay onto an updated base — while keeping commits that others have already pulled intact.

1. Confirm the branch is yours and unshared, or that collaborators agree to a force-push; never rewrite history on `main`/shared branches.
2. Snapshot a safety net: note the current SHA (`git rev-parse HEAD`) or create a backup branch (`git branch backup/<name>`) so you can recover.
3. Update the base first: `git fetch origin` then `git rebase origin/main` (or `git rebase -i origin/main` to also clean history in one pass).
4. In interactive mode pick actions per line — `reword`, `squash`/`fixup`, `edit`, `drop`, reorder — keeping the oldest commit at the top.
5. Resolve any conflicts as they surface: fix files, `git add`, then `git rebase --continue`; use `git rebase --abort` to bail back to the pre-rebase state.
6. Verify the result: `git log --oneline origin/main..HEAD` and run tests, since rebasing can silently break a previously-working intermediate state.
7. Publish with `git push --force-with-lease` (safer than `--force`: it refuses if the remote moved unexpectedly).

## Rules
- Only rebase commits that exist solely on your local/feature branch; rebasing pushed-and-pulled commits breaks teammates.
- Always force-push with `--force-with-lease`, never plain `--force`.
- Keep a backup branch or recorded SHA before starting; `git reflog` is your fallback if you skipped that.
- Resolve conflicts commit-by-commit — don't blindly `git checkout --theirs/--ours` without understanding each.
- If a rebase gets messy, `git rebase --abort` and reconsider rather than fighting it.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.