Skip to main content

graft reset

Reset the current (non-main) branch to match main’s current tip commit. The branch directory is replaced with main’s tree.

Usage

graft reset

Behavior

  1. Resolve main’s tip commit hash
  2. Load main’s tree entries
  3. Stop the container
  4. Materialize main’s files into the current branch directory (overwriting everything)
  5. Move the current branch’s ref to main’s tip
  6. Start the container

Example

graft checkout experiment

# Make changes...
graft commit -m "experiment changes"

# Decide to start fresh from main
graft reset
Resetting branch experiment to main's save-point a1b2c3d...
Branch experiment reset to main (a1b2c3d).

Notes

  • This command only works when the active branch is not main
  • The reset is destructive to the branch’s working directory but the DAG history remains intact
  • To recover a reset branch’s previous state, roll back using the commit hash

Exit Codes

CodeMeaning
0Reset successful
1Error (already on main, no commits, main not found)