tip No. 12-gazillion:

Never ever add generated stuff to a git repository when ALL things one needs to generate the stuff are IN the repository!

· · Web · 2 · 1 · 2

@musicmatze I’m curious what your reasoning is for this tip, because I see pros/cons to both approaches; committing or not committing generated files.

There are no pros. It is wasting space, it adds stuff to your Repository that does not have to be there because it always can be generated when needed and it is cluttering the history and decreasing discoverability (diff with thousands of lines of unreadable XML for example)

@musicmatze The cons you listed are valid; generated code adds size to the repository, can clutter the history/grep when searching for things.
There are also pros in some cases, but I see you had a recent bad experience with generated code and don’t want to push in case your intent was just to vent, and not to start a technical discussion.

@Flarnie @musicmatze I generally don’t commit generated files to the repo, because in some sense it seems redundant and wasteful. But I sometimes make exceptions when the content generation process isn’t fully automated, or maybe generation is expensive in some way.

Eg, for cross-platform Java code, I’ll often commit native library dependencies to the repo, since building those libraries requires a totally different toolchain than the Java code does.

@musicmatze I fundamentally agree, and I‘d like to phrase it as Joe Armstrong (Erlang) said: computation isn’t important, once you have all data it can be carried out wherever and whenever. The data is the important part, and Git is really good at keeping certain kinds of data, which is used in computation/compilation etc. HOWEVER, generated artifacts are also really important, because it can be infeasible to always reconstruct them from their source. [1/2]

@musicmatze I think that what the larger git ecosystem needs is a de-facto standard way of reliably sharing such generated artefacts outside of the repository, while still being linked to the repository. Uploading on a web/FTP server is not the solution, neither is git-annex and definitely not git LFS! Maybe IPFS is, but it‘s not something which works without setup. I don’t have a good answer for this problem. [2/2]

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!