Skip to content

Aniketsy/grebase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

grebase β€” git rebase without the fear

CI PyPI License: MIT Python Status


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 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.11+. pipx is 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 git is on your PATH. Run pipx ensurepath after installing pipx.


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:

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

Flags:

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

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.


How it looks

$ 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

Safety

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

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 manually and run grebase --continue.


Contributing

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.py and grebase/conflict_classifier.py
pytest                        # run tests
grebase --dry-run --verbose   # test against a local repo

MIT License Β· Built for devs who live in the terminal Β· github.com/Aniketsy/grebase

About

Git rebase conflicts are painful. Let grebase fix them for you. πŸ˜‰

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors