4

A lot of people keep saying that it is a bad practice to commit built files in a repository, but i find that not doing it leads to a lot of troubles.

I also think that this has to be reconsidered given the strong advantages that build files provide in deploying generic web content.

A few context notes:

  • using git
  • developing for the web
  • developing for software modularity, so no giant code monoliths involved
  • developing for reusability, and possibly sharing as free software
  • by built files i mean textual files like compiled HTML, CSS or Javascript, not binary files

In this context, committing built files strongly simplifies the deployment process, allowing easy deploying with just a static server, and thus:

  • easy local set up of the project also for the non technical
  • deployment does not require build dependencies
  • easy deploy and demo on github gh-pages
  • making built assets reusable by who references the repository with bower
  • easier troubleshooting of build errors among members of a team

There are several means of configuring git in order to make built file handling more convenient, and not by accident they are often using by people working with style compilers or javascript transpilers. Compiled files used to be binary in the past and i can agree in that case to not commit them, but in web development we are daily building a lot of text files and they are so conveniently moved around with their source inside the same git repo.

At this point, if no disadvantages can be found, saying that committing built files is bad practice becomes just an unreasonable dogma.

So what are the actual drawbacks in committing built files? What are, on the other end, the advantages?


Related questions:

Community
  • 1
  • 1
danza
  • 11,511
  • 8
  • 40
  • 47
  • What do you mean by a `built file`? Are you taking about rendered HTML or compiled source code? – wdh Jan 21 '14 at 13:37
  • thanks i specified better – danza Jan 21 '14 at 13:38
  • First, i'm not a web developer. That said, I don't see why. It is waste of space to commit "build" files into the repository. If the build files can be recreated by a make/ant/maven then what do you gain? Its like committing dependancies into the repo. Don't use a dependency manager for stuff like that. – John Jan 21 '14 at 16:33
  • i explained what i gain. so your point is that they are a waste of space. the analogy with dependencies is interesting. indeed, to deploy a web asset, usually also dependencies have to be provided, and actually i have been committing dependencies as well. while not enjoing doing so, i think it helped handling a project in a team, and it makes deploy easier. – danza Jan 21 '14 at 18:06
  • possible duplicate of [Bower check in components](http://stackoverflow.com/questions/17186377/bower-check-in-components) – Sindre Sorhus Jan 21 '14 at 21:36
  • it can not be both a duplicate and an opinion-based question, can it? – danza Jan 22 '14 at 11:35

0 Answers0