Skip to main content

Command

Enum Command 

Source
pub enum Command {
Show 28 variants Clean { path: Option<PathBuf>, }, Smudge { path: Option<PathBuf>, skip: bool, }, Install { local: bool, force: bool, skip_repo: bool, skip_smudge: bool, }, Uninstall { local: bool, skip_repo: bool, }, Track { patterns: Vec<String>, lockable: bool, not_lockable: bool, dry_run: bool, verbose: bool, json: bool, no_excluded: bool, filename: bool, }, Untrack { patterns: Vec<String>, }, FilterProcess { skip: bool, }, Fetch { args: Vec<String>, dry_run: bool, json: bool, all: bool, refetch: bool, stdin: bool, prune: bool, include: Vec<String>, exclude: Vec<String>, }, Pull { refs: Vec<String>, include: Vec<String>, exclude: Vec<String>, }, Push { remote: String, args: Vec<String>, dry_run: bool, all: bool, stdin: bool, object_id: bool, }, Clone { args: Vec<String>, }, PostCheckout { args: Vec<String>, }, PostCommit { args: Vec<String>, }, PostMerge { args: Vec<String>, }, PrePush { remote: String, url: Option<String>, dry_run: bool, }, Version, Pointer { file: Option<PathBuf>, pointer: Option<PathBuf>, stdin: bool, check: bool, strict: bool, no_strict: bool, }, Env, Ext, Migrate { cmd: MigrateCmd, }, Checkout { paths: Vec<String>, to: Option<String>, ours: bool, theirs: bool, base: bool, }, Prune { dry_run: bool, verbose: bool, }, Fsck { refspec: Option<String>, objects: bool, pointers: bool, dry_run: bool, }, Status { porcelain: bool, json: bool, }, Lock { paths: Vec<String>, remote: Option<String>, refspec: Option<String>, json: bool, }, Locks { remote: Option<String>, path: Option<String>, id: Option<String>, limit: Option<u32>, refspec: Option<String>, verify: bool, json: bool, }, Unlock { paths: Vec<String>, id: Option<String>, force: bool, remote: Option<String>, refspec: Option<String>, json: bool, }, LsFiles { refspec: Option<String>, long: bool, size: bool, name_only: bool, all: bool, debug: bool, json: bool, },
}

Variants§

§

Clean

Run the clean filter: read content on stdin, write a pointer on stdout.

Fields

§path: Option<PathBuf>

Working-tree path of the file being cleaned. Substituted for %f in any configured lfs.extension.<name>.clean command.

§

Smudge

Run the smudge filter: read a pointer on stdin, write content on stdout.

Fields

§path: Option<PathBuf>

Working-tree path of the file being smudged (currently unused).

§skip: bool

Pass the pointer text through unchanged; equivalent to GIT_LFS_SKIP_SMUDGE=1. Wired up by install --skip-smudge.

§

Install

Configure git to invoke git-lfs as the clean/smudge/process filter, and install the LFS git hooks.

Fields

§local: bool

Set config in the local repo only (default: –global).

§force: bool

Overwrite existing config and hooks.

§skip_repo: bool

Only set the filter config; don’t install hooks.

§skip_smudge: bool

Configure the smudge filter to pass pointer text through unchanged. Use with a follow-up git lfs pull to download content on demand.

§

Uninstall

Reverse of install: clear the filter.lfs.* config and remove the LFS git hooks. Hooks that don’t match what we’d write are left untouched.

Fields

§local: bool

Operate on the local repo only (default: –global).

§skip_repo: bool

Only unset config; don’t touch hooks.

§

Track

Track a file pattern with git-lfs by adding it to .gitattributes. With no patterns, lists currently-tracked patterns.

Fields

§patterns: Vec<String>

File patterns to track (e.g. “.jpg”, “data/.bin”).

§lockable: bool

Mark the tracked pattern as lockable (*.psd lockable).

§not_lockable: bool

Re-track an existing pattern, removing its lockable flag.

§dry_run: bool

Print what would happen without modifying .gitattributes or re-staging files.

§verbose: bool

Extra logging: print “Found N files previously added to Git matching pattern” lines.

§json: bool

Listing mode only: emit JSON instead of the human-readable listing.

§no_excluded: bool

Listing mode only: suppress the “Listing excluded patterns” section.

§filename: bool

Treat each pattern as a literal filename — escape glob metacharacters (*, ?, [, ], backslash, space) so the entry in .gitattributes matches that exact name even when it contains shell-glob characters.

§

Untrack

Stop tracking a file pattern with git-lfs by removing it from .gitattributes. The matching pointer files in history (and the objects in the local store) are left in place.

Fields

§patterns: Vec<String>

File patterns to untrack.

§

FilterProcess

Run the long-running filter-process protocol with git over stdin/stdout. This is what git invokes via filter.lfs.process and is the batched alternative to per-invocation clean/smudge.

Fields

§skip: bool

Pass smudge requests’ pointer text through unchanged; equivalent to GIT_LFS_SKIP_SMUDGE=1. Wired up by install --skip-smudge.

§

Fetch

Download every LFS object reachable from the given refs (default: HEAD) that isn’t already in the local store. Walks history, dedupes by OID.

Fields

§args: Vec<String>

First positional arg is treated as a remote name (if it resolves); subsequent args are refs.

§dry_run: bool

List the objects that would be fetched without downloading them (one fetch <oid> => <path> line per object).

§json: bool

JSON output. With --dry-run, queries the server’s batch endpoint to populate actions URLs.

§all: bool

Walk every local ref under refs/heads/* + refs/tags/*.

§refetch: bool

Re-download objects we already have (e.g. recovery from a corrupt local store).

§stdin: bool

Read refs from stdin, one per line. Blank lines dropped.

§prune: bool

Run prune after the fetch completes.

§include: Vec<String>

Comma-separated globs; only matching paths are fetched. Falls back to lfs.fetchinclude when omitted.

§exclude: Vec<String>

Comma-separated globs; matching paths are skipped. Falls back to lfs.fetchexclude when omitted.

§

Pull

fetch then re-run the smudge filter so the working tree contains real LFS file contents instead of pointer text. Requires git lfs install to have wired up the smudge filter.

Fields

§refs: Vec<String>

Refs to scan for LFS pointers. Defaults to HEAD.

§include: Vec<String>

Comma-separated globs; only matching paths are pulled. Falls back to lfs.fetchinclude when omitted.

§exclude: Vec<String>

Comma-separated globs; matching paths are skipped. Falls back to lfs.fetchexclude when omitted.

§

Push

Upload every LFS object reachable from the given refs that the remote doesn’t already have. The “doesn’t have” set is approximated by refs/remotes/<remote>/*; the LFS server’s batch API also dedupes server-side so missing exclusions don’t waste bandwidth.

Fields

§remote: String

Name of the remote (e.g. “origin”) whose tracking refs are excluded from the upload set.

§args: Vec<String>

Refs (or, with --object-id, raw OIDs) to push. With --all, restricts the all-refs walk to these; with --stdin, ignored (a warning is emitted).

§dry_run: bool

List the objects that would be pushed without actually uploading them (one push <oid> => <path> line per object).

§all: bool

Push every local ref under refs/heads/* and refs/tags/* (intersected with args if any are given).

§stdin: bool

Read refs (or OIDs, with --object-id) from stdin, one per line. Blank lines are skipped.

§object_id: bool

Treat positional args / stdin entries as raw LFS OIDs rather than git refs, and upload those objects directly from the local store.

§

Clone

Deprecated. Wraps git clone so the working tree is populated with pointer text first, then runs git lfs pull to download LFS content in batch. Modern git clone parallelizes the smudge filter and is no slower; prefer it.

Fields

§args: Vec<String>

git clone and LFS pass-through args. The repository URL is required; an optional target directory follows.

§

PostCheckout

Git post-checkout hook entry point. Receives <prev-sha> <post-sha> <flag> (flag is “1” if HEAD moved). Currently a no-op stub — exists so installed hook scripts don’t fail. Real behavior arrives with track --lockable.

Fields

§args: Vec<String>
§

PostCommit

Git post-commit hook entry point. No arguments. Currently a no-op stub.

Fields

§args: Vec<String>
§

PostMerge

Git post-merge hook entry point. Receives <squash-flag>. Currently a no-op stub.

Fields

§args: Vec<String>
§

PrePush

Git pre-push hook entry point — not typically invoked by hand. Reads <local-ref> <local-sha> <remote-ref> <remote-sha> lines from stdin and uploads the LFS objects newly reachable from each <local-sha>.

Fields

§remote: String

Name of the remote being pushed to.

§url: Option<String>

URL of the remote (informational; we use lfs.url config).

§dry_run: bool

List the objects that would be pushed without actually uploading them.

§

Version

Print the git-lfs version and exit.

§

Pointer

Debug helper: build a pointer from a file, parse one from disk or stdin, or just check whether some bytes are a valid pointer.

Fields

§file: Option<PathBuf>

Build a pointer from this file (read content, hash, encode).

§pointer: Option<PathBuf>

Parse and display this existing pointer file.

§stdin: bool

Read a pointer from stdin (mutually exclusive with –pointer).

§check: bool

Validity check mode: exit 0 if input parses, 1 if not, 2 if --strict and not byte-canonical.

§strict: bool

In --check, also reject non-canonical pointers.

§no_strict: bool

Explicitly disable strict mode (paired with --strict).

§

Env

Show the LFS environment: version, endpoints, on-disk paths, and the three filter.lfs.* config values.

§

Ext

List the configured LFS pointer extensions (lfs.extension.<name>.*). Extensions chain external clean/smudge programs around each LFS object; this prints their resolved configuration in priority order.

§

Migrate

Analyze or rewrite history for LFS conversion. Phase 1 ships info only; import and export will land in subsequent phases.

Fields

§

Checkout

Replace pointer text in the working tree with actual LFS object content. With no args, materializes every LFS pointer in HEAD’s tree. With paths (literal file names or trailing-slash directory prefixes), restricts to matching pointers.

During a merge conflict, --to <path> --ours/--theirs/--base <file> writes the LFS content from one of the conflicted stages to <path> (creating intermediate directories) so the user can compare or salvage versions.

Fields

§paths: Vec<String>

Paths to check out. Empty = everything in HEAD’s tree. In conflict mode (--to), exactly one path is required.

§to: Option<String>

Conflict-mode: write the chosen stage’s content to this path instead of into the working tree. Resolves relative to the current directory.

§ours: bool

Conflict-mode: pull from stage 2 (HEAD’s version). Mutually exclusive with --theirs and --base.

§theirs: bool

Conflict-mode: pull from stage 3 (the merging-in version).

§base: bool

Conflict-mode: pull from stage 1 (the common ancestor).

§

Prune

Delete local LFS objects that aren’t reachable from HEAD or any unpushed commit. Reclaims disk for repos whose history has moved past their objects.

Fields

§dry_run: bool

Don’t delete anything; just report what would go.

§verbose: bool

Print each prunable object’s OID and size.

§

Fsck

Check the integrity of LFS objects and pointers reachable from <refspec> (default: HEAD). Exit 1 if anything is corrupt.

Fields

§refspec: Option<String>

Ref to scan. Defaults to HEAD.

§objects: bool

Only check objects (verify store contents match pointer OIDs).

§pointers: bool

Only check pointers (flag non-canonical pointer encodings).

§dry_run: bool

Report problems but don’t move corrupt objects to <lfs>/bad/.

§

Status

Show staged + unstaged changes, classifying each blob as LFS, Git, or working-tree File.

Fields

§porcelain: bool

Stable one-line-per-change format for scripts.

§json: bool

Stable JSON output for scripts; only LFS entries are reported.

§

Lock

Acquire an exclusive server-side lock on one or more files. Other users will be unable to push changes to a locked file.

Fields

§paths: Vec<String>

Paths to lock (repo-relative or absolute, must resolve inside the working tree).

§remote: Option<String>

Specify which remote to use when interacting with locks.

§refspec: Option<String>

Refspec to associate the lock with. Defaults to the current branch’s tracked upstream (branch.<current>.merge) or the current branch’s full ref (refs/heads/<branch>).

§json: bool

Stable JSON output for scripts.

§

Locks

List file locks held on the server.

Fields

§remote: Option<String>

Specify which remote to use when interacting with locks.

§path: Option<String>

Filter results to a particular path.

§id: Option<String>

Filter results to a particular lock id.

§limit: Option<u32>

Maximum number of results to return.

§refspec: Option<String>

Refspec to filter locks by (defaults to current branch / tracked upstream — same auto-resolution as git lfs lock).

§verify: bool

Verify ownership: prefix locks owned by the authenticated user with O (others get ).

§json: bool

Stable JSON output for scripts.

§

Unlock

Release a file lock previously acquired with git lfs lock. Either provide one or more paths, or --id <id> (mutually exclusive).

Fields

§paths: Vec<String>

Paths to unlock; mutually exclusive with --id.

§id: Option<String>

Lock id to release; mutually exclusive with paths.

§force: bool

Forcibly break another user’s lock(s).

§remote: Option<String>

Specify which remote to use when interacting with locks.

§refspec: Option<String>

Refspec to send with the unlock request (defaults to current branch / tracked upstream).

§json: bool

Stable JSON output for scripts.

§

LsFiles

List LFS-tracked files visible at a ref (default: HEAD), or across all reachable history with --all.

Fields

§refspec: Option<String>

Ref to list. Defaults to HEAD.

§long: bool

Show full 64-char OID instead of the 10-char prefix.

§size: bool

Append humanized size in parens.

§name_only: bool

Print only the path.

§all: bool

Walk every reachable ref’s full history.

§debug: bool

Multi-line per-file block (size, checkout, download, oid, version).

§json: bool

Stable JSON output for scripts.

Trait Implementations§

Source§

impl FromArgMatches for Command

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Subcommand for Command

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.