Added extra logic to try to work out the original branch when in detached head state