GIT LFS - Git extension for versioning large files
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency. However, Git was not originally designed to work with large files, where single file size can be from few Mb to several Gb. GitHub and other service providers have a maximum size limit on the file size, e.g. GitHub max size limit of a single file is 100MB. Git-lfs helps to overcome this problem.
GIT LFS (Large File Storage) is a Git extension for versioning large files.
Getting Started with git-lfs
Download and install Git LFS from official site. There are several options available for installations, for Mac brew install git-lfs
Verify that git-lfs is installed successfully by running git lfs install from any directory.
Now navigate to your git repository where you would like to manage large files using Git LFS cd your_repo_dir . If you are creating a new repository, make sure you have run git init.
Configure the files that need to be tracked by git lfs as git lfs track "*.psd"
Make sure .gitattributes is tracked as part of the change logs by running git add .gitattributes
How does git-lfs work?
Projects with large files, particularly large files that are modified regularly, git initial clone can take a huge amount of time. This is because every version of every file needs to be downloaded by the client. Git LFS (Large File Storage) reduces the impact by lazily downloading the relevant versions.
Git LFS downloads the large files during checkout process rather than downloading during cloning or fetching.
Git LFS does this by replacing the large files in your repo with tiny pointer files.
When a new file is added, Git LFS replaces its contents with a pointer, and stores the file contents in a local Git LFS cache.
Upon git push to remote, any Git LFS files linked to pushed commits are transferred from your local Git LFS cache to the remote Git LFS store.
Upon git checkout, if this commit contains Git LFS pointers, they are replaced with files from local Git LFS cache, or downloaded from the remote Git LFS store.
Git LFS seamlessly integrates with existing git workflow, you simply use the same set of git commands.