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 pull

Command reference for `libra pull`

Fetch objects from a remote and integrate the fetched branch into the current branch.

Synopsis

libra pull [--ff-only] [--ff] [--no-ff] [--squash] [--no-commit] [--commit] [--autostash] [--no-progress] [--rebase] [--no-rebase] [--depth <n>] [<repository> [<refspec>]]

Description

libra pull combines fetch and the same merge engine used by libra merge. It downloads new objects, updates remote-tracking refs, and then integrates the selected upstream into the current branch.

With --rebase (-r), the integration step instead replays local-only commits on top of the fetched upstream tip. This is equivalent to libra fetch followed by libra rebase <upstream>.

With --ff-only, pull fetches the upstream but refuses to create a merge commit when local and remote histories have diverged. Fast-forward and already-up-to-date pulls still succeed. --ff-only conflicts with --rebase, --ff, and --no-ff.

With --no-ff, pull always records a real merge commit even when the upstream could be fast-forwarded, mirroring git pull --no-ff. --ff explicitly allows the default fast-forward behaviour. --ff, --no-ff, and --ff-only are mutually exclusive and conflict with --rebase.

With --depth <n>, the fetch phase is limited to a shallow history of n commits per tip before integration, mirroring git pull --depth. --depth is fetch-only and conflicts with --rebase.

When invoked with no arguments, the command reads the current branch tracking configuration (branch.<name>.remote and branch.<name>.merge). When <repository> is given alone, the current branch name is used as the remote branch. When both <repository> and <refspec> are given, the specified remote branch is fetched and merged.

Pull supports already-up-to-date, fast-forward, and single-head three-way merge results. If the local and remote branches conflict, pull returns the merge-owned LBR-CONFLICT-002 error with phase: "merge" and leaves the same merge state that libra merge uses. Resolve conflicts with libra add <path> and libra merge --continue, or run libra merge --abort.

With --squash, pull fetches and computes the merge but stages the merged tree without creating a commit or moving HEAD, leaving the result ready for a plain libra commit (mirroring git pull --squash). With --no-commit, pull performs the merge and stages the result but stops before committing, recording merge state so the two-parent commit can be finalized with libra merge --continue. --squash and --no-commit conflict with each other and with --rebase. --commit forces a merge commit (the default merge behavior) and is last-one-wins with --no-commit (the final flag on the command line decides); it conflicts with --squash and --rebase, matching git pull --commit.

With --autostash, pull stashes your tracked working-tree changes before integrating (so a dirty tree does not block the merge/rebase) and re-applies them afterwards — even if the merge/rebase fails. Untracked and ignored files are left in place. If re-applying the stash conflicts, the stash is kept and the failure is reported; recover it with libra stash pop.

Options

Flag / ArgumentDescriptionExample
<repository>Remote name to pull from. When omitted, uses the current branch's configured upstream.libra pull origin
<refspec>Branch name on the remote. Requires <repository>. When omitted, uses the current branch name.libra pull origin main
--ff-onlyRefuse to create a merge commit; succeeds only for fast-forward or already-up-to-date pulls. Conflicts with --rebase, --ff, --no-ff.libra pull --ff-only
--ffExplicitly allow a fast-forward merge (the default). Conflicts with --no-ff, --ff-only, --rebase.libra pull --ff
--no-ffAlways create a merge commit even when a fast-forward is possible. Conflicts with --ff, --ff-only, --rebase.libra pull --no-ff
--squashStage the merged tree without committing or moving HEAD, leaving the result for a plain libra commit. Conflicts with --no-commit, --rebase.libra pull --squash
--no-commitMerge and stage but stop before committing, recording merge state to finalize with libra merge --continue. Conflicts with --squash, --rebase.libra pull --no-commit
--commitForce a merge commit (the default); last-one-wins with --no-commit. Conflicts with --squash, --rebase.libra pull --commit
--autostashStash tracked changes before integrating and re-apply them afterwards (even on failure), so pull works on a dirty tree. Untracked/ignored files are left in place.libra pull --autostash
--no-progressSuppress the fetch progress meter (the "Receiving objects" spinner), matching git pull --no-progress.libra pull --no-progress
--notesForward to the fetch: also import the file-dependency graph (refs/notes/deps, lore.md 3.2) from a local Libra upstream. Default OFF (Git parity); a network/plain-Git upstream warns and imports nothing (deferred, D17). See libra fetch --notes.libra pull --notes
--depth <n>Limit the fetch phase to a shallow history of n commits per tip. Conflicts with --rebase.libra pull --depth 1
-r, --rebaseAfter fetching, rebase the current branch onto the upstream tip instead of merging.libra pull --rebase
--no-rebaseMerge instead of rebasing (the default), countermanding an earlier --rebase/-r (last one wins). Pull merges by default, so on its own this is a no-op.libra pull --no-rebase
--jsonEmit structured JSON envelope to stdout (global flag).libra pull --json
--machineCompact single-line JSON; suppresses progress (global flag).libra pull --machine
--quietSuppress all progress and merge summary output.libra pull --quiet

Examples

libra pull
libra pull origin main
libra pull --ff-only
libra pull --no-ff
libra pull --depth 1
libra pull --rebase origin main

Human Output

Default human mode writes fetch progress to stderr and the pull summary to stdout.

Fast-forward:

From [email protected]:user/repo.git
   abc1234..def5678  origin/main
Updating abc1234..def5678
Fast-forward
 3 files changed

Clean three-way merge:

From [email protected]:user/repo.git
   abc1234..def5678  origin/main
Updating abc1234..def5678
Merge made by the 'three-way' strategy.
 2 files changed

Already up to date:

From [email protected]:user/repo.git
Already up to date.

No tracking information:

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

    libra pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    libra branch --set-upstream-to=origin/<branch> main

Rebase:

From [email protected]:user/repo.git
   abc1234..def5678  origin/main
Successfully rebased 2 commits onto 'origin/main' (1111111..2222222).

--quiet suppresses all progress and merge summary output.

Structured Output

--json writes one success envelope to stdout. --machine writes the same schema as one compact JSON line. Success leaves stderr clean.

{
  "ok": true,
  "command": "pull",
  "data": {
    "branch": "main",
    "upstream": "origin/main",
    "fetch": {
      "remote": "origin",
      "url": "[email protected]:user/repo.git",
      "refs_updated": [
        {
          "remote_ref": "refs/remotes/origin/main",
          "old_oid": "abc1234...",
          "new_oid": "def5678..."
        }
      ],
      "objects_fetched": 12,
      "bytes_received": 2048
    },
    "merge": {
      "strategy": "three-way",
      "old_commit": "abc1234...",
      "commit": "def5678...",
      "files_changed": 2,
      "up_to_date": false,
      "parents": ["abc1234...", "fedcba9..."]
    }
  }
}

Rebase output omits merge and includes rebase:

{
  "ok": true,
  "command": "pull",
  "data": {
    "branch": "main",
    "upstream": "origin/main",
    "fetch": {
      "remote": "origin",
      "url": "[email protected]:user/repo.git",
      "refs_updated": [],
      "objects_fetched": 0,
      "bytes_received": 0
    },
    "rebase": {
      "status": "completed",
      "old_commit": "1111111...",
      "commit": "2222222...",
      "replay_count": 2,
      "up_to_date": false
    }
  }
}

Schema Notes

  • branch is the current local branch being updated.
  • upstream is the remote tracking branch name, such as "origin/main".
  • fetch.refs_updated lists remote refs that changed during fetch.
  • Exactly one of merge or rebase is present, depending on whether --rebase was passed.
  • merge.old_commit is the pre-merge HEAD; it is null on the first pull into an empty local branch.
  • merge.strategy is "fast-forward", "three-way", or "already-up-to-date".
  • merge.commit is the new HEAD commit after merge; it is null when up to date.
  • merge.parents appears for successful three-way merge commits.
  • merge.files_changed is the number of paths changed by the merge result.
  • rebase.status is "completed", "fast-forwarded", "already-up-to-date", or "no-commits".
  • rebase.replay_count is the number of local commits replayed onto the upstream tip.
  • rebase.up_to_date is true when the rebase did not move HEAD.

Parameter Comparison: Libra vs Git vs jj

ParameterLibraGitjj
Basic pulllibra pullgit pullN/A (jj uses jj git fetch + working copy)
Pull from specific remotelibra pull origin maingit pull origin mainN/A
Fast-forward integrationSupportedSupportedN/A
Fast-forward-only pulllibra pull --ff-onlygit pull --ff-onlyN/A
Three-way integrationSupported through merge engineSupportedN/A
Rebase on pulllibra pull --rebasegit pull --rebaseN/A
Force merge commitlibra pull --no-ffgit pull --no-ffN/A
Shallow pulllibra pull --depth 1git pull --depth 1N/A
Squashlibra pull --squashgit pull --squashN/A
No-commitlibra pull --no-commit (finalize with libra merge --continue)git pull --no-commitN/A
Force-commit overridelibra pull --commit (last-one-wins with --no-commit)git pull --commitN/A
Autostashlibra pull --autostashgit pull --autostashN/A
Suppress progresslibra pull --no-progressgit pull --no-progressN/A
Structured output--json / --machineNoNo
Phase diagnosticsphase detail in error JSONNoNo

Error Handling

Every PullError variant maps to an explicit StableErrorCode. Fetch, merge, and rebase sub-errors are forwarded with a phase detail for diagnostics.

ScenarioError CodeExitHint
HEAD is detachedLBR-REPO-003128"checkout a branch before pulling"
No tracking info for branchLBR-REPO-003128Git-style advisory block with libra pull <remote> <branch> and libra branch --set-upstream-to=...
Remote not foundLBR-CLI-003129"use 'libra remote -v' to see configured remotes"
Fetch: network unreachable / timeoutLBR-NET-001128"check network connectivity and retry"
Fetch: authentication failedLBR-AUTH-001128"check SSH key or HTTP credentials"
Fetch: protocol errorLBR-NET-002128"the remote did not respond correctly"
Merge: conflicts, dirty worktree, or untracked overwriteLBR-CONFLICT-002128"resolve conflicts, then run 'libra merge --continue'"
Merge: non-fast-forward rejected by --ff-onlyLBR-CONFLICT-002128"run 'libra pull' without --ff-only to allow a merge commit"
Rebase: conflict during replayLBR-CONFLICT-001128"resolve conflicts, stage them, then run 'libra rebase --continue'"
Rebase: dirty worktreeLBR-REPO-003128"commit or stash your changes before rebasing"
Merge: invalid targetLBR-CLI-003129"verify the upstream ref and try again"
Merge: unrelated histories or invalid merge stateLBR-REPO-003128"inspect branch history and merge state"
Merge: repository corruptionLBR-REPO-002128"inspect repository state and object integrity"
Merge: read failureLBR-IO-001128"check repository metadata and permissions"
Merge: write failureLBR-IO-002128"check filesystem permissions and retry"

Phase Detail

When a sub-operation fails, the error JSON includes a phase key in the details object ("fetch", "merge", or "rebase") so agents can distinguish which stage failed.

libra publish

Command reference for `libra publish`

libra push

Command reference for `libra push`

On this page

SynopsisDescriptionOptionsExamplesHuman OutputStructured OutputSchema NotesParameter Comparison: Libra vs Git vs jjError HandlingPhase Detail