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 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.
pipx install grebaseRequires Python 3.11+.
pipxis recommended so it doesn't pollute your global environment.
For contributors:
git clone https://github.com/Aniketsy/grebase
pip install -e .[dev]Windows: Install Git for Windows and make sure
gitis on your PATH. Runpipx ensurepathafter installing pipx.
grebase # auto-detect target branch and rebase
grebase main # rebase onto main
grebase origin/main # rebase onto a specific remote refMid-rebase commands:
grebase --continue # after manually resolving a conflict
grebase --skip # skip the current commit
grebase --abort # bail out and restore original stateFlags:
| Flag | Description |
|---|---|
--policy mine|theirs |
Default for ambiguous conflicts: keep yours or take theirs |
--safe-only |
Auto-resolve only β never guess, prompt for everything else |
--dry-run |
Simulate the full rebase without writing any files |
--non-interactive |
No prompts β exits if a decision is needed |
--audit |
Write a decision log to .git/grebase.log |
--remote <name> |
Remote to use: auto, origin, upstream, or any name |
--status |
Show current rebase state |
--verbose |
Detailed output |
--version |
Show grebase version and exit |
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.
$ grebase main
β Repository detected
β Current branch: feature/auth-improvements
β Target branch: main
β Incoming changes β auth.py, yarn.lock
β import conflict in auth.py β auto-resolved
β yarn.lock β regenerated via yarn install
! Conflict: utils.ts β semantic change detected
1. Keep mine 2. Take theirs
3. Keep mine (all) 4. Take theirs (all)
5. Show diff 6. Skip 7. Abort
> 2
β Rebase complete β 3 commits applied cleanly
- Never rewrites logic silently. Semantic conflicts always get a prompt.
- Always abortable.
Ctrl+Corgrebase --abortrestores your branch exactly as it was. - Audit trail.
--auditlogs every decision to.git/grebase.log. - Dry-run first.
--dry-runshows exactly what would happen before touching anything.
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 manually and run grebase --continue.
Contributions are very welcome β this is early-stage and your feedback matters.
- Read CONTRIBUTING.md to get started
- Keep PRs small and focused
- Add tests for any new behavior
- New conflict resolvers go in
grebase/rules.pyandgrebase/conflict_classifier.py
pytest # run tests
grebase --dry-run --verbose # test against a local repoMIT License Β· Built for devs who live in the terminal Β· github.com/Aniketsy/grebase