agentleFS
tejastn10tejastn10/workbench/skills/quality/rebase-clean/SKILL.md

rebase-clean

Skill1 starsChanged 2 months agoMITView on GitHub

Tidy a feature branch before it merges — squash fixup commits into their targets, drop "wip" noise, reorder so prefactors come first, rebase onto the base branch, keep history linear. Only on unshared branches. Use when asked to "clean up the branch", "squash the fixups", "rebase onto main", or before opening / updating a PR.

  • Deletes or force-pushes
  • Commits and pushes

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Fixups first, as you go: When you fix a review comment, commit it as git commit --fixup <sha> (or --squash).

    line 19
  2. Distinctive:

    Don't rebase main or any long-lived shared branch.

    line 38

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Rebase a branch clean

Goal: the branch reads as the sequence of changes you wish you'd made — linear, each commit meaningful, ready to review commit-by-commit.

Before touching anything

  • Is the branch shared? If someone else has it checked out or has built on it, don't rewrite without agreeing. A solo feature branch is fair game.
  • git fetch and note the base (main).

The passes

  1. Fixups first, as you go. When you fix a review comment, commit it as git commit --fixup <sha> (or --squash). Then one git rebase -i --autosquash <base> folds every fixup into its target automatically.
  2. Interactive rebase (git rebase -i <base>) for the rest:
    • drop pure noise ("wip", "typo", "revert the revert").
    • squash / fixup commits that only exist to patch an earlier one.
    • reword bad subjects into conventional form.
    • move prefactors and refactors ahead of the feature commit.
  3. Rebase onto the base — resolve conflicts as they come (quality/resolve-merge-conflicts), git rebase --continue.
  4. Verify — build + tests on the final tip, and ideally spot-check that a mid-branch commit builds (for quality/bisect).
  5. Force-push with lease — git push --force-with-lease (never plain --force), so you don't clobber someone else's push.

Rules

  • --force-with-lease, not --force.
  • Don't rebase main or any long-lived shared branch.
  • Merge commits from main into the feature branch → prefer rebasing instead so history stays linear; if the team merges, follow the team.

Anti-patterns

  • ❌ Rewriting a branch other people have based work on.
  • ❌ git push --force (use --force-with-lease).
  • ❌ Squashing everything into one commit when the steps were meaningfully separate.
  • ❌ A final tip that passes but broken commits in the middle.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.