If your project contains large files (e.g. binary files for designs, videos, audio...), the Large File Storage extension for Git might be worth a look.
Git LFS improves the handling of large files and their storage - so that you don't have to download massive amounts of binary file data. Instead, Git LFS downloads only the data you actually need in any given situation. This prevents your local Git repository's file size from exploding.
Hosting Service Support
LFS is an extension to the standard Git feature set. Please make sure that your code hosting provider actually supports Git LFS!
Installation & Activation
Tower comes with built-in support for Git LFS. You don't have to install the extension manually on your local computer.
However, before you can use Git LFS in a repository, you have to explicitly enable it. Open the repository in Tower and navigate to the
In the tab, activation is as simple as hitting the button.
Tracking Files with LFS
You need to explicitly configure which files (or types of files) you want to be tracked by LFS.
The easiest way to do this is through Tower's Working Copy view: simply right-click the file in question and select one of the options from thesubmenu.
You'll notice that another change will happen in your repository when you mark a file to be tracked with LFS: Git notes the file names and patterns in a text file named ".gitattributes". This should be staged and committed to the repository like any other change.
Tracking Files Retroactively
Right after creating a new repository is the best time to decide which files should be handled through LFS.
The reason for this is simple: when a file has already been committed to the repository, it has become part of the project's commit history. It is both difficult and invasive to remove files from your history. In any case, you will have to rewrite your project's commit history.
Therefore, remember to make these settings right after you create a new repository.
Overview of Tracked Files
Theview provides an overview of which files / file types are currently tracked by LFS:
In addition to providing an overview, this view also helps you manage your tracked files:
- Removing patterns: move the mouse over any of the lines to have a button shown. This lets you delete a tracking directive, stopping LFS from handling this file / file type.
- Adding new patterns: as an alternative to using the Working Copy view for adding tracking patterns, you can also add them here. Simply click the button and enter the desired pattern manually.
Cloning a Git-LFS-Enabled Repository
The main reason why LFS is so helpful is that it saves your local repositories from becoming unnecessarily big. Thereby, LFS prevents you from downloading unnessary data - and ultimately saves you time and disk space.
These benefits can be reaped right from the start: when cloning a Git-LFS-enabled repository, the "Clone Repository" dialogs in Tower offer a "Use LFS Clone" option. Be sure to check it in appropriate situations to make cloning more efficient.
If you want to learn more about Git LFS, take a look at the respective chapter in our free online book.