composer.lock in .gitignore?

252 views
Skip to first unread message

Davide Orazio Montersino

unread,
Jul 23, 2014, 9:16:41 AM7/23/14
to php...@googlegroups.com
Hi, I'm probably going to contribute to this project; I forked it and I'm working on it.

..I noticed that as soon as I install it, git marks composer.lock as modified: could it be a good idea to list it into the .gitignore file?

Andrei Dascalu

unread,
Aug 29, 2014, 2:53:31 AM8/29/14
to php...@googlegroups.com
I'm not a project member, but speaking as a adeveloper for other projects, I would observe that:
composer.json is the base for the 'composer update' command (it looks for desired packages and grabs the newest allowed version, then modifying the composer.lock accordingly -> which is probably why you see it as modified after install)
composer.lock is the base for the 'composer install' command (it grabs the packages with the specific version from the lock file, unless the json lists removed or added packages). Basically the lock servers to, well, 'lock' the versions for delivery (whoever gets it can be sure they are using the same versions as last tested). It doesn't make sense to put the lock in the .gitignore (especially since the gitignore will be then grabbed by others). Personally I am a user and if I pull from the repo, I'd prefer to install from the lock rather than risk an update.

If you want to ensure that you won't accidentally commit an unwanted modified lock, you can add it in the .git/info/exclude inside the repository folder. It kindof acts as a .gitignore but with local effects.

Best regards,
Andrei
Reply all
Reply to author
Forward
0 new messages