Skip to main content

grebase

Rebase without the wreckage. Handles the obvious. Asks you about the rest.

CI PyPI License: MIT Status: Active

$ grebase main

  ✔  fetched origin
  ✔  3 commits ahead, 7 commits behind
  ⚡  conflict in api/auth.js — import order only → auto-resolved
  ⚡  conflict in yarn.lock → regenerating with yarn install
  ?  conflict in src/utils.ts — semantic change detected

  [1] keep yours   [2] take theirs   [3] show diff   [4] open editor
  → 2

  ✔  rebase complete — 7 commits applied cleanly

Why grebase?

Rebasing is painful because of the middle part — editing conflict markers in files, remembering to git add instead of git commit, repeating this for every commit. Most conflicts are actually trivial (import reordering, lockfile churn, whitespace) but git treats them all the same.

grebase handles the boring ones automatically and surfaces only the ones that genuinely need your eyes.


Install

pipx install grebase

Requires Python 3.9+. pipx is recommended so it doesn't pollute your global environment.

For contributors:

git clone https://github.com/your-org/grebase
pip install -e .[dev]

Usage

grebase              # auto-detect target branch and rebase
grebase main         # rebase onto main
grebase origin/main  # rebase onto a specific remote ref

Mid-rebase commands (when a rebase is already in progress):

grebase --continue   # after manually resolving a conflict
grebase --skip       # skip the current commit
grebase --abort      # bail out and restore original state

Common flags:

Flag Description
--remote <name> Remote to use: auto, origin, upstream, or any name
--policy <mode> Default for ambiguous conflicts: prompt · current · incoming
--safe-only Auto-resolve only, never guess — prompt for everything else
--non-interactive No prompts — exits if a decision is needed
--dry-run Simulate the full rebase without writing any files
--audit Write a decision log to .git/grebase.log
--status Show current rebase state
--verbose Detailed output

What it auto-resolves

grebase applies deterministic rules. It never guesses at logic — if a conflict looks semantic, it asks you.

Conflict type What grebase does
Import statements Merges unique imports from both sides
Whitespace / formatting Takes the non-whitespace version silently
Documentation Safely merges when both sides only change docs
Duplicate inserts Deduplicates identical blocks
Lockfiles Regenerates using the right package manager

Lockfile regeneration — grebase runs the correct tool automatically:

poetry.lock       → poetry lock
Pipfile.lock      → pipenv lock
package-lock.json → npm ci
yarn.lock         → yarn install
pnpm-lock.yaml    → pnpm install

If the tool isn't installed or fails, grebase falls back to prompting you.


Before it starts

grebase prints a summary of incoming changes before touching anything — so you know what's about to happen:

  main is 7 commits ahead of your branch
  ─────────────────────────────────────────
  a3f1c2e  fix: update token expiry logic
  8bc09d1  feat: add rate limiting middleware
  ...
  → 2 files will likely conflict (api/auth.js, src/config.ts)

Safety

  • Never rewrites logic silently. Semantic conflicts always get a prompt.
  • Always abortable. Hit Ctrl+C or run grebase --abort to restore your branch exactly as it was.
  • Audit trail. --audit logs every decision grebase makes to .git/grebase.log.
  • Dry-run first. Not sure? grebase --dry-run shows exactly what would happen.

Troubleshooting

Dirty working tree Commit or stash your changes first, then run grebase.

Rebase already in progress Use grebase --continue, grebase --abort, or grebase --skip.

Lockfile tool missing Install the relevant package manager, or resolve the lockfile manually and run grebase --continue.


Contributing

Contributions are very welcome — this is early-stage and your feedback matters.

  • Read docs/contributing.md to get started
  • Keep PRs small and focused
  • Add tests for any new behavior
  • New conflict resolution rules go in grebase/resolvers/ — each rule is one file
# run tests
pytest

# run against a local repo
grebase --dry-run --verbose

MIT License · Built for devs who live in the terminal

Metadata

Release files for grebase 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for grebase 0.1.0
File Size Uploaded
grebase-0.1.0.tar.gz 19.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for grebase 0.1.0
File Interpreter ABI Platform
grebase-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 35.9 kB

Release files / grebase-0.1.0.tar.gz

Download URL grebase-0.1.0.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c335de488796016fb867910a09d7a306b43f9a420cf686548f58406101270463
BLAKE2b-256 checksum
How to use checksums
b3625b7c4f054a926e76902b4ab9736183ea45a708060497bde00d0c4a6cdb71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / grebase-0.1.0-py3-none-any.whl

Download URL grebase-0.1.0-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b18df7ff2d905727c546c212e1d01054e7cc67937c92cef3c853a2f7b37e5fdc
BLAKE2b-256 checksum
How to use checksums
14ce9ca9a11ae7214c7e694140e7d13a58743ec733556917065b985d4db37f64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page