Refactor code that orders remotes by priority

See corresponding algorithm in hub: https://github.com/github/hub/blob/master/lib/hub/context.rb#L211-L215
Fix priority of loading origin remotes
Origin returns valid GitHub remote
Introduce lookup order for origin names
Merge pull request #508 from github/upstream_pr

gh: Refactor code that orders remotes by priority