Toolkit: Perforce, Git LFS & .gitignore
Unreal projects are mostly binary: .uasset and .umap files can't be merged, are often large, and with World Partition there are tens of thousands of small ones. Version control for Unreal has to handle large binaries and, above all, file locking, so two people never edit the same Blueprint at once and lose one person's work.
Perforce
Perforce (Helix Core server; P4V desktop client) is the long-standing standard in game studios, including at Epic. Why studios use it:
- Handles very large repositories and binary files natively, with no extra layer.
- Exclusive checkout: the typemap marks
.uasset/.umapas+l, so only one person can check out a file at a time. - The editor integrates with it: Revision Control (called Source Control in older versions) shows checkout state in the Content Browser and checks out assets when you save.
- Unreal Game Sync (UGS) syncs code and precompiled editor binaries together, so artists never compile.
- Streams for branching (main / release / dev streams).
A typical typemap (set by the server admin with p4 typemap):
TypeMap:
binary+l //...uasset
binary+l //...umap
binary+l //....fbx
binary+l //....png
text //....ini
text //....cpp
text //....hPerforce is free for small teams up to a user/workspace limit, with paid plans beyond that; check Perforce's current terms. Running the server is your job (a small cloud VM is enough for a small team).
Git with Git LFS
Git works well for small and medium Unreal teams, provided you add Git LFS (Large File Storage) for binaries and use its locking:
# .gitattributes
*.uasset filter=lfs diff=lfs merge=lfs -text lockable
*.umap filter=lfs diff=lfs merge=lfs -text lockable
*.fbx filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.wav filter=lfs diff=lfs merge=lfs -textgit lfs install
git lfs lock Content/Characters/BP_ArenaCharacter.uasset # before editing a Blueprint
git lfs locks # who has what
git lfs unlock Content/Characters/BP_ArenaCharacter.uasset # after pushinglockable makes the files read-only in your working copy until you lock them, a reminder the editor will surface when you try to save. The editor's built-in Git revision-control provider is basic; many teams use the community Git LFS 2 plugin (by SRombauts, with forks such as Project Borealis') for lock status in the Content Browser.
Watch the limits of your Git host: LFS storage and bandwidth quotas, and file size limits. Check your host's current terms; a busy Unreal project goes through gigabytes quickly.
.gitignore for Unreal
# Generated by builds and the editor
Binaries/
Intermediate/
Saved/
DerivedDataCache/
# Same folders inside plugins
Plugins/**/Binaries/
Plugins/**/Intermediate/
# IDE files (regenerated from the .uproject)
.vs/
.idea/
.vscode/
*.sln
*.suo
*.VC.db
*.opensdfNever commit Saved/ (logs, autosaves, local config, crash dumps) or DerivedDataCache/ (cached shader and asset data, rebuilt automatically, or shared through a shared DDC on the network for big teams).
Which one?
| Perforce | Git + LFS | |
|---|---|---|
| Large binary repos | designed for it | works, with LFS quotas and some tooling friction |
| Locking | built in, enforced | LFS locks, enforced only by the lockable attribute and team discipline |
| Engine integration | first-class | basic built-in provider; community plugins |
| Code review / CI tooling | Swarm, other tools | every Git tool (PRs, Actions…) |
| Cost and setup | a server to run; licence beyond small teams | hosted options; LFS storage fees |
Small teams and solo developers often start on Git LFS. Teams with many artists, World Partition maps and source-built engines tend to move to Perforce. Pick early: migrating history later is painful.
A runnable .gitignore check
This model implements the parts of .gitignore matching used above (directory patterns, **, * wildcards, ! negation) and checks which paths of a typical project would be committed.
#include <iostream>
#include <string>
#include <vector>
// Glob match where '*' doesn't cross '/', and "**/" matches zero or more directories.
bool Glob(const char* p, const char* s) {
if (*p == 0) return *s == 0;
if (p[0] == '*' && p[1] == '*' && p[2] == '/') {
for (const char* t = s;; ++t) {
if (Glob(p + 3, t)) return true;
while (*t && *t != '/') ++t;
if (!*t) return false;
}
}
if (*p == '*') {
for (const char* t = s;; ++t) {
if (Glob(p + 1, t)) return true;
if (!*t || *t == '/') return false;
}
}
return *s && *p == *s && Glob(p + 1, s + 1);
}
bool Matches(std::string pat, const std::string& path) {
bool dirOnly = pat.back() == '/';
if (dirOnly) pat.pop_back();
bool anchored = pat.find('/') != std::string::npos;
// A directory pattern matches any path under that directory.
for (size_t i = 0; i <= path.size(); i++) {
if (i < path.size() && path[i] != '/') continue;
std::string prefix = path.substr(0, i);
if (dirOnly && i == path.size()) continue; // the path itself is a file
if (anchored ? Glob(pat.c_str(), prefix.c_str())
: Glob(pat.c_str(), prefix.substr(prefix.rfind('/') + 1).c_str())) return true;
}
return false;
}
int main() {
std::vector<std::string> rules = {"Binaries/", "Intermediate/", "Saved/", "DerivedDataCache/",
"Plugins/**/Binaries/", ".vs/", "*.sln", "Build/*/*", "!Build/*/*.ini"};
std::vector<std::string> paths = {
"Arena.uproject", "Source/Arena/ArenaCharacter.cpp", "Content/Maps/L_Arena_01.umap",
"Binaries/Win64/UnrealEditor-Arena.dll", "Saved/Logs/Arena.log", "Arena.sln",
"Plugins/ArenaTools/Binaries/Win64/UnrealEditor-ArenaTools.dll", "Plugins/ArenaTools/Source/ArenaTools.cpp",
"Build/Windows/Application.ico", "Build/Windows/DefaultEngine.ini",
};
for (const auto& path : paths) {
bool ignored = false;
for (const auto& r : rules)
if (r[0] == '!') { if (Matches(r.substr(1), path)) ignored = false; }
else if (Matches(r, path)) ignored = true; // later rules win
std::cout << (ignored ? "ignored " : "COMMIT ") << path << "\n";
}
}COMMIT Arena.uproject
COMMIT Source/Arena/ArenaCharacter.cpp
COMMIT Content/Maps/L_Arena_01.umap
ignored Binaries/Win64/UnrealEditor-Arena.dll
ignored Saved/Logs/Arena.log
ignored Arena.sln
ignored Plugins/ArenaTools/Binaries/Win64/UnrealEditor-ArenaTools.dll
COMMIT Plugins/ArenaTools/Source/ArenaTools.cpp
ignored Build/Windows/Application.ico
COMMIT Build/Windows/DefaultEngine.ini
The last two rules show the trick for "ignore a folder except some files": ignore the folder's contents (Build/*/*) and re-include with !. Writing Build/*/ instead would not work in real Git, which can't re-include a file whose parent directory is excluded (a rule this model skips). Always confirm with git check-ignore -v <path>.
Test yourself
Why is file locking essential for Unreal projects?
- Locks speed up builds
- .uasset/.umap files are binary and can't be merged, so concurrent edits lose work
- Git requires it
- Perforce can't work without it
What does the lockable attribute in .gitattributes do?
- Encrypts files
- Makes the files read-only until you take an LFS lock
- Excludes them from LFS
- Stores them uncompressed
Which folder should be committed?
- Saved/
- DerivedDataCache/
- Config/
- Intermediate/