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
Maybe best would be to move the 7 new lines above in a else{} block below line 67 actually, that way you also don't have this branchAliasVersion code in the middle of the code fetching the date :)