Learning Git: What is Git LFS?

Learning Git: What is Git LFS?

Advanced Git tutorial video

Git LFS stands for Large File Storage and is a tool many developers use to save space when working with binary files.

Watch this quick video or keep reading to learn more!

Download our Git GUI client for free, to easily work with your repos.

Download GitKraken Free

What is Git LFS?

In short, Git LFS is a Git extension that allows users to save space by storing binary files in a different location. Let’s dig in a bit to learn more about why you would want to use Git LFS and how it works:

Why use Git LFS?

When working with repositories that contain audio, video, or image files (aka binary files), any changes made to those files are not tracked through Git in the same way that non-binary files are tracked.

While Git does a great job of tracking change sets in text files, changes made to binary files are tracked as an additional copy of the file.

Imagine you are working with a binary image that takes up 100MB on your repo and you make a change to that file. Git will track that change on a file that also takes up 100MB of space and will continue to do that for each change made.

If you want to do some quick math… Four file changes made to a binary 100MB file would result in a total of 500MB used (100MB original file + 100MB change file + 100MB change file + 100MB change file + 100MB change file = 500MB).

Because these changes also get pushed to your remote, your remote will also grow in size, decreasing the speed in which you can clone, push, pull, or perform other operations with your repo.

How does Git LFS save time?

When using Git LFS, your commits will point to a lightweight reference object instead of pointing back to the binary file (you’re actually pushing the original binary file to an LFS repo).

Now, when you clone the LFS repo or check out a branch in an LFS repo, you will only pull the version of the binary file that you need from the LFS server, saving space and time.

How does Git LFS work in GitKraken?

Before using Git LFS in GitKraken, you must first install Git LFS on your machine. You will also need to set up your LFS server, and if you’re just getting started, GitHub has a built-in free option available here.

Once installed, navigate to Preferences to access the LFS option.

You may then initialize LFS for an existing repo and specify the file types you need the application to track.

After you complete the initialization process, an LFS icon will appear in the toolbar, allowing you to interact with the files on your LFS server.

Where can I view LFS files?

All files tracked by LFS will be marked with the LFS icon in the Right Panel of GitKraken.

When you click to view the diff of such a file, you will see the SHA reference instead of your large file.

Finally, you may check the option to initialize the LFS application when you Init any repo from GitKraken.

We hope this helps explain the benefits of using a Git Large File Server and how easy it is to utilize the application in GitKraken.

Stay on the cutting edge of software development by getting innovative tips, trends and stories delivered to your inbox every month!

Agile project management software
Plan, develop, review, and ship fast

Visit Axosoft.com

Legendary suite of developer tools
GitKraken Git GUI, Boards & Timelines

Visit GitKraken.com