Forrest logo
back to the git tool

git-lfs:tldr:b432b

git-lfs: List tracked patterns.
$ git lfs track
try on your machine

The git lfs track command is used in conjunction with Git Large File Storage (LFS) to specify which files in a Git repository should be managed by LFS.

When you have large files in your repository (such as binary files, multimedia assets, or large datasets), Git LFS allows you to store only the pointer to these files in Git, while the actual file content is stored separately on a remote server. This prevents the repository from becoming bloated with large files and helps improve performance.

To use Git LFS, you need to specify which files should be tracked. This is where the git lfs track command comes in. When you run this command, you define file patterns (using wildcard characters) that match the files you want to be handled by LFS. The patterns can be based on file extensions, folder names, or any other criteria.

Here's an example:

git lfs track "*.png"

In this case, the command tells Git LFS to track and manage all PNG (Portable Network Graphics) image files in the repository. When you add or commit a file with the ".png" extension, Git LFS will replace the file content in the repository with a pointer to the actual file stored on the LFS server.

After running git lfs track, the LFS configuration for the repository will be modified to include this file pattern. You can view the current LFS configuration using the command git lfs env, which will show the tracked file patterns and other LFS settings.

Overall, the git lfs track command is used to indicate which files should be handled by Git LFS, allowing you to manage large files more efficiently within your Git repository.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the git tool