Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

How to track a single file or a directory in git-lfs


The context menu only has the option to add a complete file type. Online, I also only find ways to add complete file types to lfs.

From the look of it, it seems that it should be possible to use more specific patterns for folders / subfolders / filetypes, but I can't get that to work; lfs only ever works if it's really only a "*.mytype" declaration.

In some cases, I really want to track some specific folders and files in LFS while others of the same filetype should live in regular git land. Specifically, the ".asset" extension in Unity is used for a ton of things ranging from simple, text-readable ScriptableObjects (which should live in git land) to texture arrays with a size of several hundred MB (that's for LFS then).

Edit/Addendum: seems I can workaround by having a "fake" extension like ".lfs.asset", which I can manually add to the .gitattributes file. Also, I figured that sometimes (not always) directory pathes seem to work, as long as they don't contain any spaces and thus don't need any "" or '' in the .gitattributes file... but that's more of a workaround than a real solution, so please chime in if you know more!

1 answer

0 votes
minnsey Atlassian Team Apr 30, 2019


Your best bet is probably reaching out to the LFS community directly

Why is that? Just because I can work around some missing UI pieces / functionality in SourceTree doesn't mean that the UI is good...


At least, please consider this a feature request to provide more than just "track file type" in the SourceTree UI.

minnsey Atlassian Team Apr 30, 2019

Apologies I thought you meant that the directory patterns you manually added sometimes worked.

you can raise feature requests at

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Sourcetree

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

78,949 views 134 29
Read article

Atlassian Community Events