session

Manage session branches and history. Sessions track the image state as you run commands, with support for branching and rollback.

Examples

# Show current session
contree session

# List all sessions
contree session list

# Show full history
contree session show

# Create and switch to a branch
contree session branch experiment
contree session checkout experiment

# Switch back
contree session checkout main

# Create a branch from another branch
contree session branch hotfix --from main

# List branches (* marks active)
contree session branch

# Undo last operation
contree session rollback

# Undo last 3 operations
contree session rollback 3

# Import image from another session
contree session use other-session

# Delete a session
contree session delete my-old-session
contree session rm my-old-session -y

Help output

$ contree session --help usage: contree session [-h]                        {list,ls,use,branch,br,checkout,co,rollback,rb,show,wait,delete,rm,del} ... Manage session branches and history. Without a subcommand, shows the current session info (key, branch, image, last operation). Subcommands:   list (ls)       List all sessions   use KEY         Import another session's current image   branch (br)     List or create branches (--from to fork)   checkout (co)   Switch active branch   rollback (rb)   Navigate history: N=absolute, -N=back, +N=forward   show            Display the session history DAG positional arguments:   {list,ls,use,branch,br,checkout,co,rollback,rb,show,wait,delete,rm,del}     list (ls)           List all sessions     use                 Import another session's image     branch (br)         List, create, delete, or prune branches     checkout (co)       Switch active branch     rollback (rb)       Navigate history: N=absolute, -N=back, +N=forward     show                Show session history     wait                Wait for operations to reach terminal state     delete (rm, del)    Delete sessions by key options:   -h, --help            show this help message and exit for coding agents:   session (no subcommand) is read-only   branch/checkout/rollback/session use mutates local session pointers   `session show` defaults to last 20 history entries; pass -a/--all for full DAG   use `session show` to inspect history DAG before destructive navigation   `session wait [OPS...]` waits for active or specified operations agent note:   Before using this command in an automated workflow, read:     contree agent

Concepts

Each non-disposable contree run creates a new history entry and advances the branch pointer. Branches share the underlying history – creating a branch just adds a new pointer at the current position.

Rollback moves the branch pointer backwards. History entries are preserved and can be recovered by creating a new branch.

session delete

Remove sessions and all their data (history, branches, files, shell history).

contree session delete KEY [KEY ...]
contree session rm KEY -y     # skip confirmation
contree session del KEY

See also