Using Sourcetree’s Built‑in Git LFS Support for Large Binary Files
Learn how to enable Git LFS in Sourcetree, track a large file, push it to a remote LFS store, and verify the workflow while understanding the trade‑offs.
19 Feb 2026, 00:29 UTC

Problem: Large binaries bloat your Git history
When you add files such as videos, datasets, or compiled assets to a Git repository, each version creates a full copy in the object database. Over time the repository size grows, cloning becomes slow, and CI pipelines waste bandwidth.
Thesis: Sourcetree simplifies enabling Git LFS so that large files are stored as lightweight pointers while the actual content lives in a separate LFS store.
Enabling LFS in Sourcetree
Sourcetree detects a .gitattributes file and offers a one‑click wizard to track a file type with Git LFS. The steps below assume you have Sourcetree installed and a repository already cloned locally.
- Open the repository in Sourcetree.
- Locate the large file you want to track (e.g., a
sample.mp4that is >100 MB). - Right‑click the file in the file list and choose Track Large File.
- In the wizard, confirm the file extension (or pattern) and click OK. Sourcetree will:
- Add or update
.gitattributeswith a line like*.mp4 filter=lfs diff=lfs merge=lfs -text. - Create or update
.lfsconfigwith the remote LFS endpoint. - If Git LFS is not installed on your machine, Sourcetree will prompt to install it (requires admin rights on Windows/macOS or sudo on Linux).
- Add or update
- After the wizard finishes, the file icon changes to show an LFS badge, indicating it is now a pointer object.
Worked Example: Tracking a 150 MB Video File
This example demonstrates the full lifecycle from tracking to push and verification. Replace placeholders with your own values.
1. Prepare the file
Place a video file named demo.mp4 (≈150 MB) in the root of your local repo.
2. Track the file via Sourcetree
Follow the steps in the previous section to track *.mp4. After completion, Sourcetree shows the file with an LFS icon.
3. Commit and push
In Sourcetree:
- Stage the
.gitattributeschange and thedemo.mp4pointer. - Write a commit message such as "Add demo video via LFS" and click Commit.
- Click Push. Sourcetree will display a button Upload LFS Objects after the Git push; click it to transfer the actual video content to the remote LFS store.
4. Verify the result
You can confirm the workflow succeeded without needing to trust any output:
- In Sourcetree, after the push, the file list should still show the LFS badge and no pending uploads.
- Open a terminal (Git Bash, cmd, or shell) in the repository root and run:
You should seegit lfs ls-filesdemo.mp4listed as an LFS object. - Visit the remote hosting service (e.g., GitHub, GitLab, Bitbucket) and inspect the file. The repository UI will show the file as stored in LFS, and the commit diff will display only the pointer line (something like
version https://git-lfs.github.com/spec/v1). - Clone the repository to a different machine or directory and run:
The actual video file should be downloaded automatically, confirming that the LFS transport works.git lfs pull
Trade‑offs and Limitations
While Git LFS solves the history‑bloat problem, it introduces considerations you should monitor:
- Network overhead: Each fetch or push may need to transfer the full binary size. In CI pipelines, enable LFS caching or shallow clones to reduce repeated downloads.
- Remote host requirements: The Git server must support LFS (most major services do). If you self‑host, ensure the LFS adapter is configured and has sufficient storage.
- Storage quotas: Providers often enforce limits on LFS bandwidth or storage. Check your plan’s usage dashboard regularly.
- Dependency on Git LFS binary: Sourcetree’s UI relies on the system’s
git-lfscommand. A missing or mismatched version leads to errors during push/pull. Keep the binary up to date via your package manager or the official installer. - Pointer safety: If the LFS server becomes unavailable or the
.lfsconfigis corrupted, the actual file data cannot be retrieved, leaving only useless pointers. Back up the LFS store or use a mirroring strategy if durability is critical.
Actionable Closing
For any repository that regularly handles assets larger than a few megabytes, enable Git LFS early:
- Identify the file patterns (e.g.,
*.psd,*.zip,*.mp4) that qualify as large. - Use Sourcetree’s Track Large File wizard to create the appropriate
.gitattributesentry. - Train team members to check the LFS badge before committing and to use the Upload LFS Objects button after pushing.
- Set up a simple verification step in your CI pipeline: run
git lfs ls-filesand fail the step if any expected LFS object is missing.
By integrating these steps, you keep your Git history lean, reduce clone times, and still have the binary assets available when needed.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.