Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do developers commit .dist files instead of the actual file?

Why would a developer commit a .dist file instead of the actual file?

For example: https://github.com/FriendsOfPHP/PHP-CS-Fixer

.php_cs.dist
phpunit.xml.dist

https://github.com/symfony/symfony

.php_cs.dist
phpunit.xml.dist

Why are .php_cs and phpunit.xml committed as .dist files?

Code formatting rules are in .php_cs.dist and if every contributor should follow the same rules why .dist file?

Update

Reasoning behind parameter.yml.dist is obvious but why in particular .php_cs is not committed? Why somebody would change the .php_cs which contains code formatting rules? isn't the whole point of .php_cs that every contributor use same rules to format their code?

Please reply regards to only these two files.

like image 733
pmoubed Avatar asked Sep 09 '17 21:09

pmoubed


2 Answers

You can see .dist files as template files. On your specific distribution, the configuration might be slightly different. Using the dist files, you can simply copy them to e.g. phpunit.xml and tweak it to fit your needs. (e.g. set some specific ENV variables or the like).

Little side-note: Another common dist file in Symfony projects is app/config/parameters.yml.dist

like image 109
Wouter J Avatar answered Sep 27 '22 21:09

Wouter J


I found my answer here: https://github.com/symfony/recipes/issues/41

the difference is that PHPUnit will load the phpunit.xml.dist file if phpunit.xml does not exist. So you don't need to copy it unless you want to do special stuff. So committing a phpunit.xml.dist in the repo (and adding phpunit.xml in the gitignore) is just about following the PHPUnit best practice

The reason behind .dist file for those specific files is phpunit and php-cs-fixer use .dist file in absence of the local file.

like image 33
pmoubed Avatar answered Sep 27 '22 21:09

pmoubed