3

My project has many derived files, files generated from others, thus really duplicates. Examples:

Transpiling: I use either coffeescript or es6/babel to convert source to .js files that are redundant, in that they are easily recreated from the CS/ES6 files.

Bundling: The derived .js files are preprocessed (uglify etc) then put into myproject.js & myproject.min.js files for easy download from github.

Documentation: I use Docco to create HTML documentation of each source file, thus redundant .. the source comments create the documentation.

I'd prefer the repo be tiny and not have the derived files.

One thought is using gh-pages to have the complete set of files, using a .gitignore to skip derived files for master, but having a separate gh-pages .gitignore allowing all derived files. Seems a bit extreme though.

Is there good (standard, best practices) way to manage the derived files? They can confuse git -- making pull/merge/fetch report conflicts in derived files which we don't care about, a clean full build always is correct.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
backspaces
  • 3,802
  • 6
  • 34
  • 58

1 Answers1

0

Add a .gitignore to the root folder of your gitrepo: here

For a particular build type (eg coffeescript) google "coffeescript gitignore" and you can usually find a template. I did this for coffeescript and found this: http://heyrod.com/snippet/s/gitignore-for-coffee.html

EDIT

I didn't get the complexity from your question.

I believe I understand now. You could try using a .gitattributes as to always select "ours" or theirs when merging: How do I tell git to always select my local version for conflicted merges on a specific file?

Community
  • 1
  • 1
Grady G Cooper
  • 1,044
  • 8
  • 19
  • This has been our idea, sorta. Couple of problems: 1) git does not ignore tracked files, even if in .gitignore. There are (awkward) fixes. 2) We'd like the library users need, foolib.js, to be downloadable from github even tho it too is a generated file. (True for most repos, I think). – backspaces Apr 18 '15 at 16:48
  • I think the simplest example is a git/github Foo repo with two modules, a.js and b.js which are combined to build foo.js and foo.min.js, and use docco (or other source file based documentation) to create foo.html. Is it a best practice to have only a.js and b.js? Or include the foo library files foo.js and foo.min.js? Or even include foo.html? Github has a download feature and I think most users would be disappointed/confused if at least foo.js weren't present. – backspaces Apr 19 '15 at 17:48