git-lfs-track
Name
git-lfs-track — View or add Git LFS paths to Git attributes
Synopsis
git-lfs-track [OPTIONS] [PATTERNS]...
Description
View or add Git LFS paths to Git attributes
Start tracking the given pattern(s) through Git LFS. The argument is written to .gitattributes. If no paths are provided, list the currently-tracked paths.
Per gitattributes(5), patterns use the gitignore(5) pattern rules to match paths. This means that patterns containing asterisk (*), question mark (?), and the bracket characters ([ and ]) are treated specially; to disable this behavior and treat them literally instead, use --filename or escape the character with a backslash.
Options
Arguments
<PATTERNS>File patterns to track (e.g.*.jpg,data/*.bin)
Flags
-
-v,--verboseLog files whichgit lfs trackwill touch. Disabled by default -
-d,--dry-runLog all actions that would normally take place (adding entries to.gitattributes, touching files on disk, etc.) without performing any mutative operations.Implicitly mocks the behavior of
--verbose, logging in greater detail what it is doing. Disabled by default. -
-j,--jsonWrite the currently tracked patterns as JSON to standard output.Intended for interoperation with external tools. Cannot be combined with any pattern arguments. If
--no-excludedis also provided, that option will have no effect. -
--filenameTreat the arguments as literal filenames, not as patterns.Any special glob characters in the filename will be escaped when writing the
.gitattributesfile. -
-l,--lockableMake the paths “lockable” — they should be locked to edit them, and will be made read-only in the working copy when not locked -
--not-lockableRemove the lockable flag from the paths so they are no longer read-only unless locked -
--no-excludedDon’t list patterns that are excluded in the output; only list patterns that are tracked -
--no-modify-attrsMake matched entries stat-dirty so that Git can re-index files you wish to convert to LFS.Does not modify any
.gitattributesfile.
Examples
List the patterns that Git LFS is currently tracking:
git lfs track
Configure Git LFS to track GIF files:
git lfs track "*.gif"
Configure Git LFS to track PSD files and make them read-only unless locked:
git lfs track --lockable "*.psd"
Configure Git LFS to track the file named project [1].psd:
git lfs track --filename "project [1].psd"
See also
git-lfs-untrack(1), git-lfs-install(1), gitattributes(5), gitignore(5).
Reporting bugs
This command is from the Rust implementation of git-lfs, not the original Go implementation. Please report bugs to our issue tracker.