lfs-auto-track streamlines the management of large files in Git by automatically executing git lfs track during pre-commit hooks. Designed to seamlessly integrate with husky and lint-staged, it ensures that large files are handled properly based on user-defined configurations, simplifying the workflow for developers.
lfs-auto-track is a utility that automates the tracking of large files in a Git repository using Git LFS (Large File Storage). This tool integrates seamlessly with pre-commit hooks to ensure that specified large files are automatically added to .gitattributes, streamlining the process of managing large assets in a project.
git lfs track for large files above a predetermined size during a commit, minimizing manual intervention.lint-staged setup in package.json, allowing for customized tracking behavior based on project needs.Ensure that your project is using husky and lint-staged, and that Git LFS is installed:
git lfs install
To install lfs-auto-track, run the following command:
npm i lfs-auto-track -D
To set up automatic tracking, add a lint-staged script in your package.json:
{
"name": "module-name",
"lint-staged": {
"*": [
"lfs-auto-track 'image,video,audio:100;*:1024'"
]
}
}
'image,video,audio:100;*:1024' specifies that image, video, and audio files larger than 100 KB will be tracked, while any other file types larger than 1024 KB will also be tracked.'jpg,png,gif:1024' would track files with those specific extensions if they exceed 1024 KB.Check the source code in the repository for an illustration of how files should be managed:
git lfs push --all origin
GIT_LFS_SKIP_SMUDGE=1 git clone THE_REPO_URL
git lfs pull
Overall, lfs-auto-track simplifies and automates the management of large files in Git repositories, enhancing workflow efficiency and project organization.
No comments yet.
Sign in to be the first to comment.