你如何在git提交中处理来自预处理器的编译文件? [英] How do you handle compiled files from pre-processors in git commits?

查看:125
本文介绍了你如何在git提交中处理来自预处理器的编译文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们都喜欢像SASS / SCSS,LESS,Coffeescript等元语言。但是当谈到git提交时,有一个问题:我的源文件中的编译文件是否应该进入回购站,还是更好地忽略它们?问题是,忽略这些文件时,不能简单地使用开箱即用的存储库。在使用它之前,你必须首先编译它(到正确的位置)。这有点不好,因为不是每个人都使用预处理器。那么如何处理它呢?

解决方案

Git通常用作源跟踪系统,因此可以使用由项目的开发者。对于需要在项目中进行开发的人员,他们需要能够从源文件构建到生成的文件中。因此,在这种情况下,没有在存储库中生成的文件不会给它们带来额外的负担。



为了对最终用户有用,您可能需要项目的定期发布。这些通常会作为必要文件的档案来完成。这通常包括生成的文件,并且很可能排除源文件。对于最终用户来说,即使git本身也可能被视为不必要的工具。



在存储库中包含生成的文件对这类人无帮助,并且它使得更难以看到每次提交实际正在进行的更改。


We all like those meta languages like SASS/SCSS, LESS, Coffeescript, etc. But when it comes to git commits there is one question: Should compiled files from my source files get into the repo or is it better to ignore them? The problem is, when ignoring those files, one could not simply use the repository out of the box. You've to compile it first (to the right location) before using it. This is kinda bad way, because not everyone using pre-processors. So how to deal with it?

解决方案

Git is generally used as a source-tracking system, and as such is meant for use by developers of the project. For people to do development on the project they will need to be able to build from source files into the generated files. So in this case not having the generated files in the repository doesn't impose any additional burden on them.

To be useful for end-users, you may want to do periodic releases of the project. These would typically be done as archives of the necessary files. This would generally include generated files, and quite-possibly exclude the source files. For an end-user even git itself is likely to be seen as an unnecessary tool.

Including generated files in the repository doesn't help either of this class of people, and it makes it more difficult to see what is actually being changed by each commit.

这篇关于你如何在git提交中处理来自预处理器的编译文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆