move slightly calculating refs, to have it later for correction of partial working copies
move slightly calculating refs, to have it later for correction of partial working copies. as well include a more modern variant of !19 (closed) as we hardcode "origin" in the code. for correcting partial clones that name will be used again.
this is part of the pull request: !53 - which seemed a little big. split it.