Skip to content

Getting started

Get from a fresh clone to a previewed history rewrite in under 10 minutes.

Prerequisites

  • git on your PATH — regit performs all repository access by shelling out to the real git binary; there is no bundled git.
  • Go 1.26+ — needed to install. Both install methods below compile from source (there are no prebuilt binaries yet).
  • Optional: an LLM provider — only the split, reword, and squash verbs use an LLM (Ollama, LM Studio, OpenAI, OpenRouter, or a local Claude Code CLI via --agent). Everything else — redate, retitle, reauthor, drop-bodies, purge, redact, linearize, undo — works with no LLM configured.

Installation

go install github.com/wlame/regit/cmd/regit@latest

Installs the regit binary into your Go bin directory ($GOBIN or $GOPATH/bin).

git clone https://github.com/wlame/regit
cd regit
just build          # compiles to dist/regit with the version stamped

Or install straight onto your PATH (uses go install under the hood):

just install

Verify the install:

regit --version

Expected output:

regit dev

(just build and just install stamp a real version from git tags; a plain go install build reports dev.)

First run

Launch the TUI

Run regit inside any git repository, or point it at one:

regit                       # operate on the repo in the current directory
regit --repo=/path/to/repo

The TUI opens on your current branch's commits. Press ? for the full key overlay, P to preview pending changes, and Q to quit.

A first headless command

Every TUI action has a headless CLI equivalent, and every mutating command previews by default — running it without --execute is always safe and changes nothing. Try a date plan:

regit redate --strategy=Even-Spread --time=Working-hours --start=2026-01-01 --end=2026-03-01

This prints a date plan: one line per commit showing its short hash and the current author date -> proposed new date, followed by an ordering check. The shape looks like this (hashes and dates come from your repository):

Date plan (3 commit(s)):
  4c9d1e2a  2026-07-19 14:02 -> 2026-01-06 10:41
  9b7f03c5  2026-07-19 14:02 -> 2026-02-03 11:27
  d41a8f60  2026-07-19 14:03 -> 2026-02-27 15:55
  ✓ sequential

(dry run — nothing applied; pass --execute to apply)

To actually rewrite the branch, re-run the same command with --execute:

regit redate --strategy=Even-Spread --time=Working-hours \
  --start=2026-01-01 --end=2026-03-01 --execute

On success regit prints the new HEAD, the backup ref it created, the verifier's report, and — when the branch tracks a remote — the exact git push --force-with-lease command to publish the rewrite.

Already-pushed commits need --force

If the range includes commits that already exist on the remote, --execute alone is refused. Pass --execute --force to confirm you really want to rewrite pushed history — collaborators who pulled it will need to reconcile after your force-push.

Undo: the escape hatch

A backup ref (refs/regit/backup/<branch>/…) is created before every apply. If you change your mind:

regit undo          # restore the branch to the most recent regit backup
regit undo --list   # show available backups (read-only)

undo itself backs up the current tip first, so an undo is also reversible.

Optional: register as git re

regit can install itself as a native-feeling git subcommand by symlinking git-re next to the regit binary on your PATH:

regit install
git re              # → launches the regit TUI
git re redate --help

git re <command> and regit <command> are fully equivalent, and regit's help and hints automatically show whichever form you used. regit uninstall removes the link. One git quirk: a bare git re --help is answered by git's man-page lookup — use git re -h for the command list.

  • Use cases — complete walkthroughs of real scenarios
  • CLI reference — every command, flag, and exit code
  • Configuration — config file keys and REGIT_* env overrides
  • LLM providers — set up Ollama, OpenAI, or an agent CLI for split/reword/squash