libra libra - 3 months ago 31
Git Question

Use unity with git LFS

I'm trying to use git lfs with my unity project, but since i'm quite new to git , i'm not sure how should i make lfs track the files.

Here is a link of git ignore files i found, i suppose i should make git lfs track everything in gitignore? (https://github.com/github/gitignore/blob/master/Unity.gitignore)

But should i first git-add all the files i have in that project and then use git-lfs-track to add the files in that link to lfs? I'm extremely new to git, so if there's someone could provide me a step by step guide would be most appreciated.

Cheers

Answer

You don't need to do anything special.

Have a good read of: https://git-lfs.github.com/

git lfs track "*.fbx"

Then:

git add Assets/foo/megaship.fbx
git commit -m "Add model"
git push origin master

Git ignore is totally different. That ignores all the files in the path; they won't be committed at all.

Git lfs is a smart tracker for specially marked content items, that results in them being pushed and pulled in a special way.

To see a list of commands, just type:

git lfs

You can see the current set of tracked file types in your .gitattributes file, eg:

*.mp3 filter=lfs -text
*.MP3 filter=lfs -text

so, basically, this has nothing to do with your gitignore; just git lfs install and git lfs track and you should be good to go.

Specifically, you should just do this:

git lfs install
git lfs track "*.FILETYPE" <-- for any files you want

Now just use git normally.