Added branch-alias to version output when it is aliasing dev-master

Added branch-alias for dev-master to ```--version|-V``` output when current version is actually a revision (a non release/git tag).
This replays the work done in #3352 taking care about other uses of ```Composer::VERSION``` constant (for instance ```diagnose``` and ```self-update``` commands).

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| Doc PR        | none
If the process runs fine below at line 66 (new file, expand the block below on github) I think you should empty $this->branchAliasVersion otherwise it will always be displayed even for tagged releases.