composer/composer — pull request #1579 by jubianchi (2013-02-13 10:29:32+00:00)
Title: Add --rehash option to the update command

# Composer - Update command

## Rehash composer.lock file

In some cases, it would be usefull to rehash the ```composer.lock``` file :

* Fixing a typo/coding standard in the composer.json file makes it desynchronized with the lock file as the hash should also change
* Using the composer.json file to store some extra values (for example, used by script handlers)

Let's take an example : we clone a fresh git repository and want to fix a missing newline at the end of the composer.json file :

```sh
$ git clone git@github.com/composer/composer
$ composer.phar install --dev

$ echo >> composer.json
$ git add -p composer.json
$ git commit -m"Fix newline at EOF"
$ git push

# Other dev
$ git clone git@github.com/composer/composer
$ composer.phar install --dev

# /!\ Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
```

Sure, before committing we could issue an ```update``` command but by doing so, we could introduce broken code from dependencies, especially if they are wired to a not stable references (e.g ```@dev```, ```@RC```, ...)

This PR adds a ```--rehash``` option to the update command which will only rehash the lock file without updating repositories/dependencies :

```sh
# First dev.
$ git clone git@github.com/composer/composer
$ composer.phar install --dev

$ echo >> composer.json
$ composer.phar update --rehash --dev
$ git add -p composer.{json,lock}
$ git commit -m"Fix newline at EOF"
$ git push

# Other dev.
$ git clone git@github.com/composer/composer
$ composer.phar install --dev

# No more warning
```