libra op

Command reference for `libra op`

Inspect and restore command-level operation history.

Synopsis

libra op log [OPTIONS]
libra op show [OPTIONS] <OP_REF>
libra op restore [OPTIONS] <OP_REF>

Description

libra op provides a command-line surface over the operation graph persisted by the operation service and wrapper layers.

It currently supports three subcommands:

  • op log: list recorded operations with pagination and optional command filter.
  • op show: inspect one operation and, optionally, the captured restore view.
  • op restore: move HEAD and branch refs back to a previously captured view.

Operation References

<OP_REF> may be either:

  • A concrete operation id, for example 019e3f00-8ee5-7e62-a54c-0ab1f1bba0f9
  • A reflog-style index, for example @{0} for the newest operation or @{1} for the previous one

libra op log

List operation history.

libra op log [--page <N>] [-n <PER_PAGE>] [--command <NAME>] [--verbose]

Options

-n, --number <PER_PAGE>

Number of operations to show per page. Defaults to 50.

libra op log -n 20

--page <N>

Page number to display. Defaults to 1.

libra op log --page 2 -n 20

--command <NAME>

Filter operations by exact command name, such as branch or op restore.

libra op log --command branch
libra op log --command "op restore"

Read-only query forms do not record operations

Some repository commands have query forms that inspect state without mutating refs or config. Those forms are classified ReadOnly and do not append an Operation v2 entry (so op log --command <name> totals stay unchanged).

Branch query forms that do not record:

  • bare libra branch (list)
  • libra branch -l / -r / -a
  • libra branch --show-current
  • libra branch -v / -vv
  • list filters: --contains, --no-contains, --merged, --no-merged, --points-at, --sort, --format, --column, --no-column, --ignore-case
  • idempotent libra branch -u <upstream> when the target branch already tracks that upstream (the target is <branch> when given, otherwise HEAD)

Mutating branch forms (create, delete, rename, copy, non-idempotent -u, --unset-upstream, --edit-description, branch reset, …) still record one operation each.

Tag query forms that do not record:

  • bare libra tag and libra tag -l
  • -n, --contains, --no-contains, --points-at, --merged, --no-merged, --sort, --column, --no-column (including --no-column <pattern>)
  • libra tag --verify / -v

Creating or deleting a tag still records one operation.

Remote query forms that do not record:

  • libra remote -v and libra remote show (with or without a name)
  • libra remote show --no-query and a live libra remote show <name> (the live form contacts the remote and does not write local refs or config)
  • libra remote get-url
  • libra remote prune --dry-run

add, remove, rename, set-url, non-dry-run prune, set-head, set-branches, and update still record one operation each.

Reflog query forms that do not record:

  • bare libra reflog and libra reflog show (including show HEAD)
  • libra reflog exists
  • libra reflog expire --dry-run

reflog delete and reflog expire without --dry-run still record one operation each.

Notes query forms that do not record:

  • bare libra notes and libra notes list
  • libra notes show and libra notes get-ref
  • libra notes prune --dry-run

add, append, edit, copy, remove, merge, and prune without --dry-run still record one operation each.

--verbose

Show one operation as a multi-line block with actor, status, and timestamp.

libra op log -n 5 --verbose

libra op show

Inspect a single operation.

libra op show [--view] <OP_REF>

Options

--view

Print the captured restore view, including HEAD target and refs.

libra op show @{0} --view

libra op restore

Restore repository state to a previously captured operation view. HEAD and the captured branch refs are reset to the target view, and local branches that are absent from that view are pruned, so the restore reproduces the operation's exact local-branch set. The restored HEAD branch is always kept; remote-tracking refs are never pruned. The Libra-owned capture ref refs/libra/traces and legacy intent/libra/intent history refs keep their current values; a restore does not rewind or prune them.

libra op restore [--force] [--dry-run] <OP_REF>

Options

--force

Allow restore to proceed even if the working tree is dirty.

libra op restore @{0} --force

--dry-run

Show the target HEAD and refs without writing a new restore operation.

libra op restore @{0} --dry-run

Examples

# List the newest ten operations
libra op log -n 10

# Show only branch operations on page 2
libra op log --command branch --page 2 -n 5

# Inspect the latest operation and its view snapshot
libra op show @{0} --view

# Restore to the previous operation view
libra op restore @{1}

# Preview a restore without changing repository state
libra op restore @{1} --dry-run

Notes

  • op restore records a new op restore operation on success.
  • op restore --dry-run does not write a new operation.
  • Restore resets HEAD and the branch refs captured in the target view, and prunes local branches that are absent from that view (the restored HEAD branch is always kept; remote-tracking refs are left untouched).