[Developer] Fix parsing of remote git version with similar branch names.
(cherry-picked from 4c5ab569430708dc5db3f9911fb689552f743eba)