Skip to main content

Safe, rule-based Git rebase assistant

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grebase-0.1.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grebase-0.1.0-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file grebase-0.1.0.tar.gz.

File metadata

  • Download URL: grebase-0.1.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for grebase-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c335de488796016fb867910a09d7a306b43f9a420cf686548f58406101270463
MD5 6bd3359e1f08738cb8ec7a22d011d11d
BLAKE2b-256 b3625b7c4f054a926e76902b4ab9736183ea45a708060497bde00d0c4a6cdb71

See more details on using hashes here.

File details

Details for the file grebase-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: grebase-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for grebase-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b18df7ff2d905727c546c212e1d01054e7cc67937c92cef3c853a2f7b37e5fdc
MD5 fbf0d2a3f1e962b6a36337e4319c8daa
BLAKE2b-256 14ce9ca9a11ae7214c7e694140e7d13a58743ec733556917065b985d4db37f64

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page