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 write-tree

Command reference for `libra write-tree`

Write the current index out as a tree object and print its object id — the plumbing companion to read-tree, equivalent to git write-tree.

Synopsis

libra write-tree

Description

write-tree reads .libra/index and constructs a nested Git tree object (one tree per directory), writing every tree object to the object store and printing the root tree's object id. File modes (regular, executable, symlink, gitlink) are preserved, and the object format (SHA-1 / SHA-256) follows the repository's hash kind.

An empty index produces the canonical empty tree (4b825dc642cb6eb9a060e54bf8d69288fbee4904 for SHA-1).

This is a read-only plumbing command: it writes tree objects but does not move any ref or change the index or working tree.

Options

OptionDescriptionExample
--json / --machineStructured output: { tree: "<id>" }.libra --json write-tree

Git's --prefix=<prefix> and --missing-ok are not exposed (deferred).

Exit codes

CodeMeaning
0The tree was written; its id is printed.
128Not inside a repository, or the index/tree could not be processed.

Examples

# Write the index and capture the tree id
TREE=$(libra write-tree)

# Structured output for agents
libra --json write-tree

Comparison with Git

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

libra worktree

Command reference for `libra worktree`

API Reference

Complete API documentation and reference

On this page

SynopsisDescriptionOptionsExit codesExamplesComparison with Git