PBFs are large (Germany is about 4.5 GB). Keep one copy in a shared cache and symlink it into projects.
First: find the cache
PBF_DIR="${OSM_PBFS_DIR:-$HOME/Development/_osm-pbfs}"; ls -lh "$PBF_DIR"
Folder missing → read references/setup.md first.
Rules
- Symlink, never copy, a PBF from the cache into a repo.
- Never download an extract that is already in the cache.
- A missing extract goes into the cache, then gets symlinked.
- Never commit
.osm.pbffiles; make sure*.osm.pbfis gitignored.
ln -s "$PBF_DIR/berlin-latest.osm.pbf" ./berlin-latest.osm.pbf # absolute target, works from worktrees
curl -L -o "$PBF_DIR/brandenburg-latest.osm.pbf" \
"https://download.geofabrik.de/europe/germany/brandenburg-latest.osm.pbf"
Ask the user first
- The project holds a real (not symlinked) copy: offer to replace it with a
symlink; delete the duplicate only after they confirm, with
trash, notrm. - The user wants a private copy: follow that.