𝗕𝘂𝗶𝗹𝗱𝗶𝗻𝗴 𝗘𝗳𝗳𝗶𝗰𝗶𝗲𝗻𝘁 𝗩𝗲𝗿𝘀𝗶𝗼𝗻 𝗖𝗼𝗻𝘁𝗿𝗼𝗹 𝗪𝗶𝘁𝗵𝗼𝘂𝘁 𝗗𝘂𝗽𝗹𝗶𝗰𝗮𝘁𝗶𝗻𝗴 𝗙𝗶𝗹𝗲𝘀

Storing full copies of files for every version or fork wastes space. If you change one line in a project with ten files, you should not save all ten files again.

I faced this problem while building my LaTeX Writer project. I needed a way to handle version control and project forking without high storage costs.

I looked at how GitHub works. GitHub does not store a full repository every time you make a change. It stores content separately and uses references to link files and commits.

I built my system using three main components:

The system works through content hashing. When you save a file, the system generates a unique ID based on the content. If the content already exists, the system reuses the existing Blob. It does not create a new one.

This approach makes forking easy and cheap. When you fork a project:

No actual file content is copied during a fork. You only duplicate the small metadata records.

When you edit a fork, the process stays efficient:

This method provides several benefits:

You get GitHub-like functionality without the heavy storage overhead.

Source: https://dev.to/prashant_patil_49/building-github-inspired-version-control-and-forking-without-duplicating-project-files-5aap