LibraLibra
LibraLibra
DocsBlogLibra
Getting Started
Architecture
Design
Commands
libra addlibra agentlibra alternateslibra applylibra archivelibra authlibra automationlibra bisectlibra blamelibra branchlibra bundlelibra cachelibra cat-filelibra check-attrlibra check-ignorelibra check-mailmaplibra checkoutlibra cherry-picklibra cleanlibra clonelibra cloudlibra code-controllibra codelibra commit-treelibra commitlibra completionslibra configlibra credentiallibra depslibra describelibra diff-fileslibra diff-indexlibra diff-treelibra difflibra dirtylibra fast-exportlibra fast-importlibra fetchlibra filelibra for-each-reflibra format-patchlibra fscklibra gclibra graphlibra greplibra hash-objectlibra hookslibra hydratelibra index-packlibra initlibra investigatelibra layerlibra lfslibra loglibra logfilelibra loginlibra logoutlibra ls-fileslibra ls-remotelibra ls-treelibra maintenancelibra medialibra merge-baselibra merge-filelibra mergelibra metadatalibra mvlibra noteslibra oplibra openlibra pack-objectslibra packagelibra prunelibra publishlibra pulllibra pushlibra read-treelibra rebaselibra refloglibra remotelibra repacklibra replacelibra rererelibra resetlibra restorelibra rev-listlibra rev-parselibra revertlibra reviewlibra revisionlibra rmlibra sandboxlibra servicelibra shortloglibra show-reflibra showlibra sparse-viewlibra stashlibra statslibra statuslibra switchlibra symbolic-reflibra taglibra update-indexlibra update-reflibra usagelibra verify-packlibra whoamilibra worktreelibra write-tree
API Reference
Policy
Commands

libra read-tree

Command reference for `libra read-tree`

Read a tree object into the index — the plumbing companion to write-tree, a focused subset of git read-tree.

Synopsis

libra read-tree <tree-ish>

Description

read-tree resolves <tree-ish> to a tree, flattens it into stage-0 index entries, and replaces .libra/index with that content. <tree-ish> may be:

  • a tree object id,
  • a commit object id (peeled to its tree),
  • a ref, tag, branch name, or HEAD (peeled to its tree).

This first version is index-only: it never touches the working tree, so it cannot silently overwrite working-tree files. The Git options that would modify the working tree or perform a merge (-u, -m, --reset, --prefix) are not exposed — use libra restore / libra checkout to update the working tree.

Options

OptionDescriptionExample
<tree-ish>The tree to read (tree id, commit, ref, tag, or HEAD).libra read-tree HEAD
--json / --machineStructured output: { tree: "<id>", entries: <n> }.libra --json read-tree HEAD

Exit codes

CodeMeaning
0The tree was read into the index.
128Not inside a repository, or <tree-ish> is not a valid tree-ish.

Examples

# Reset the index to HEAD's tree (working tree untouched)
libra read-tree HEAD

# Read a specific tree id captured from write-tree
TREE=$(libra write-tree)
libra read-tree "$TREE"

# Structured output for agents
libra --json read-tree HEAD

Comparison with Git

TaskLibraGit
Read a tree into the indexlibra read-tree <tree>git read-tree <tree>
Write the index as a treelibra write-treegit write-tree

Deferred (not exposed): -m (merge), -u (update working tree), --reset, --prefix, multi-tree merges.

libra push

Command reference for `libra push`

libra rebase

Command reference for `libra rebase`

On this page

SynopsisDescriptionOptionsExit codesExamplesComparison with Git