Skip to content

Commit c4727f1

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

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

tutorials/best_practices/version_control_systems.rst

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,96 @@ 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+
git lfs install
113+
114+
This will create a ``.gitattributes`` file in your repository that tells Git to
115+
use LFS for the specified file types. You can add more file types by modifying
116+
the ``.gitattributes`` file. For example, to track all GLB files, you can do this by
117+
running the following command in your terminal:
118+
::
119+
git lfs track "*.glb"
120+
121+
When you add or modify files that are tracked by LFS, Git will automatically
122+
store them in LFS instead of the regular Git history. You can push and pull
123+
LFS files just like regular Git files, but keep in mind that LFS files are
124+
stored separately from the rest of your Git history. This means that you may
125+
need to install Git LFS on any machine that you clone the repository to in
126+
order to access the LFS files.
127+
128+
Below is an example ``.gitattributes`` file that you can use as a starting point for Git LFS.
129+
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.
130+
131+
.. code-block:: gitignore
132+
133+
# Normalize EOL for all files that Git considers text files.
134+
* text=auto eol=lf
135+
136+
# Git LFS Tracking (Assets)
137+
138+
# 3D Models
139+
*.fbx filter=lfs diff=lfs merge=lfs -text
140+
*.gltf filter=lfs diff=lfs merge=lfs -text
141+
*.glb filter=lfs diff=lfs merge=lfs -text
142+
*.blend filter=lfs diff=lfs merge=lfs -text
143+
*.obj filter=lfs diff=lfs merge=lfs -text
144+
145+
# Images
146+
*.png filter=lfs diff=lfs merge=lfs -text
147+
*.svg filter=lfs diff=lfs merge=lfs -text
148+
*.jpg filter=lfs diff=lfs merge=lfs -text
149+
*.jpeg filter=lfs diff=lfs merge=lfs -text
150+
*.gif filter=lfs diff=lfs merge=lfs -text
151+
*.tga filter=lfs diff=lfs merge=lfs -text
152+
*.webp filter=lfs diff=lfs merge=lfs -text
153+
*.exr filter=lfs diff=lfs merge=lfs -text
154+
*.hdr filter=lfs diff=lfs merge=lfs -text
155+
*.dds filter=lfs diff=lfs merge=lfs -text
156+
157+
# Audio
158+
*.mp3 filter=lfs diff=lfs merge=lfs -text
159+
*.wav filter=lfs diff=lfs merge=lfs -text
160+
*.ogg filter=lfs diff=lfs merge=lfs -text
161+
162+
# Font & Icon
163+
*.ttf filter=lfs diff=lfs merge=lfs -text
164+
*.otf filter=lfs diff=lfs merge=lfs -text
165+
*.ico filter=lfs diff=lfs merge=lfs -text
166+
167+
# Godot LFS Specific
168+
*.scn filter=lfs diff=lfs merge=lfs -text
169+
*.res filter=lfs diff=lfs merge=lfs -text
170+
*.material filter=lfs diff=lfs merge=lfs -text
171+
*.anim filter=lfs diff=lfs merge=lfs -text
172+
*.mesh filter=lfs diff=lfs merge=lfs -text
173+
*.lmbake filter=lfs diff=lfs merge=lfs -text
174+
175+
For more information on Git LFS, check the official documentation:
176+
https://git-lfs.github.com/ and https://docs.github.com/en/repositories/working-with-files/managing-large-files.
177+

0 commit comments

Comments
 (0)