Skip to content

Commit 398a4db

Browse files
committed
Add Git LFS section
1 parent 8c18714 commit 398a4db

File tree

1 file changed

+95
-0
lines changed

1 file changed

+95
-0
lines changed

tutorials/best_practices/version_control_systems.rst

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,98 @@ It is better to set this option as:
8282
Creating version control metadata using the project manager or editor will
8383
automatically enforce LF line endings using the ``.gitattributes`` file.
8484
In this case, you don't need to change your Git configuration.
85+
86+
Git LFS
87+
-------
88+
89+
Git LFS (Large File Storage) is a Git extension that allows you to manage large
90+
files in your repository. It replaces large files with text pointers inside Git,
91+
while storing the file contents on a remote server. This is useful for
92+
managing large assets, such as textures, audio files, and 3D models, without
93+
bloating your Git repository.
94+
95+
.. note::
96+
97+
When using Git LFS you will want to ensure it is setup before you commit any files to your repository.
98+
If you have already committed files to your repository, you will need to
99+
remove them from the repository and re-add them after setting up Git LFS.
100+
101+
It is possible to use ``git lfs migrate`` to convert existing files in your repository, but this is more in-depth and
102+
requires a good understanding of Git.
103+
104+
A common approach is setting up a new repository with Git LFS (and a proper ``.gitattributes``), then
105+
copying the files from the old repository to the new one. This way, you
106+
can ensure that all files are tracked by LFS from the start.
107+
108+
To use Git LFS with Godot, you need to install the Git LFS extension and
109+
configure it to track the file types you want to manage. You can do this by
110+
running the following command in your terminal:
111+
::
112+
113+
git lfs install
114+
115+
This will create a ``.gitattributes`` file in your repository that tells Git to
116+
use LFS for the specified file types. You can add more file types by modifying
117+
the ``.gitattributes`` file. For example, to track all GLB files, you can do this by
118+
running the following command in your terminal:
119+
::
120+
121+
git lfs track "*.glb"
122+
123+
When you add or modify files that are tracked by LFS, Git will automatically
124+
store them in LFS instead of the regular Git history. You can push and pull
125+
LFS files just like regular Git files, but keep in mind that LFS files are
126+
stored separately from the rest of your Git history. This means that you may
127+
need to install Git LFS on any machine that you clone the repository to in
128+
order to access the LFS files.
129+
130+
Below is an example ``.gitattributes`` file that you can use as a starting point for Git LFS.
131+
These file types were chosen because they are commonly used, but you can modify the list to include any binary types you may have in your project.
132+
133+
.. code-block:: gitignore
134+
135+
# Normalize EOL for all files that Git considers text files.
136+
* text=auto eol=lf
137+
138+
# Git LFS Tracking (Assets)
139+
140+
# 3D Models
141+
*.fbx filter=lfs diff=lfs merge=lfs -text
142+
*.gltf filter=lfs diff=lfs merge=lfs -text
143+
*.glb filter=lfs diff=lfs merge=lfs -text
144+
*.blend filter=lfs diff=lfs merge=lfs -text
145+
*.obj filter=lfs diff=lfs merge=lfs -text
146+
147+
# Images
148+
*.png filter=lfs diff=lfs merge=lfs -text
149+
*.svg filter=lfs diff=lfs merge=lfs -text
150+
*.jpg filter=lfs diff=lfs merge=lfs -text
151+
*.jpeg filter=lfs diff=lfs merge=lfs -text
152+
*.gif filter=lfs diff=lfs merge=lfs -text
153+
*.tga filter=lfs diff=lfs merge=lfs -text
154+
*.webp filter=lfs diff=lfs merge=lfs -text
155+
*.exr filter=lfs diff=lfs merge=lfs -text
156+
*.hdr filter=lfs diff=lfs merge=lfs -text
157+
*.dds filter=lfs diff=lfs merge=lfs -text
158+
159+
# Audio
160+
*.mp3 filter=lfs diff=lfs merge=lfs -text
161+
*.wav filter=lfs diff=lfs merge=lfs -text
162+
*.ogg filter=lfs diff=lfs merge=lfs -text
163+
164+
# Font & Icon
165+
*.ttf filter=lfs diff=lfs merge=lfs -text
166+
*.otf filter=lfs diff=lfs merge=lfs -text
167+
*.ico filter=lfs diff=lfs merge=lfs -text
168+
169+
# Godot LFS Specific
170+
*.scn filter=lfs diff=lfs merge=lfs -text
171+
*.res filter=lfs diff=lfs merge=lfs -text
172+
*.material filter=lfs diff=lfs merge=lfs -text
173+
*.anim filter=lfs diff=lfs merge=lfs -text
174+
*.mesh filter=lfs diff=lfs merge=lfs -text
175+
*.lmbake filter=lfs diff=lfs merge=lfs -text
176+
177+
For more information on Git LFS, check the official documentation:
178+
https://git-lfs.github.com/ and https://docs.github.com/en/repositories/working-with-files/managing-large-files.
179+

0 commit comments

Comments
 (0)