Git LFS
Git Large File Storage (LFS) lets you store large binary files outside your repository while keeping them versioned alongside your code. Instead of bloating your repository with multi-megabyte assets, LFS replaces them with lightweight pointer files and stores the actual content in dedicated blob storage.Why Use Git LFS
Repositories that contain large binary files — images, videos, datasets, trained models, design files, compiled binaries — suffer from slow clones, bloated disk usage, and degraded performance. Every clone downloads the full history of every binary, even if you only need the latest version. Git LFS solves this by:- Keeping repositories fast: Only pointer files (a few bytes each) are stored in the repository. The actual file content is fetched on demand.
- Versioning large files: LFS objects are immutable and content-addressed. Every version of a file is preserved and retrievable.
- Efficient transfers: Only the LFS objects you check out are downloaded, not the entire history of every large file.
How LFS Works on JJHub
JJHub stores LFS objects in Google Cloud Storage (GCS). Uploads and downloads go directly to GCS via signed URLs — they are not proxied through the API server. This keeps transfers fast and avoids bottlenecking the API. The flow:Setup
Prerequisites
You need Git LFS installed locally. Since jj uses git as its storage backend, standard Git LFS tooling works with JJHub repositories. Install Git LFS:Repository Setup
Inside your repository, tell Git LFS which file patterns to track:git lfs track command adds an entry to the .gitattributes file in your repository root. You can also edit .gitattributes directly:
.gitattributes file must be committed to your repository. This is how collaborators and CI know which files are managed by LFS.
Push and Pull Workflow
Once LFS tracking is configured, your normal workflow does not change. Git LFS hooks handle everything transparently.Pushing LFS Objects
- jj exports refs to the git backend
- Git detects that
scene.psdmatches an LFS pattern - Git LFS uploads the file content to JJHub (via signed GCS URLs)
- Only the pointer file is pushed to the repository
Pulling LFS Objects
Checking LFS Status
To see which files are tracked by LFS and their status:Common File Patterns
Here are recommended LFS tracking patterns for common use cases:| Use Case | Pattern | Example Files |
|---|---|---|
| Images | *.png, *.jpg, *.psd, *.svg | Design assets, screenshots |
| Video | *.mp4, *.mov, *.avi | Demos, recordings |
| Audio | *.mp3, *.wav, *.flac | Sound assets |
| Datasets | *.csv, *.parquet, *.arrow | ML training data |
| Models | *.bin, *.onnx, *.safetensors | Trained ML models |
| Archives | *.zip, *.tar.gz, *.7z | Bundled assets |
| Documents | *.pdf, *.docx | Large documents |
API: Signed URL Endpoints
JJHub provides LFS endpoints for programmatic access. These follow the Git LFS Batch API specification and are used automatically by the Git LFS client.Request Upload URL
upload_url is a signed GCS URL with a short expiry. Upload the file content directly to this URL with a PUT request.
Confirm Upload
Download URL
When pulling LFS objects, the Git LFS client requests download URLs through the standard LFS Batch API. JJHub returns signed GCS URLs for direct download.Storage and Retention
- LFS objects are stored in GCS and are retained as long as they are referenced by a repository. Deleting a repository removes its LFS objects.
- LFS objects are content-addressed (identified by SHA-256 hash). Identical files uploaded to different repositories share storage.
- Storage limits per repository and organization are TBD and will be documented before general availability.