git-gui: Refactor branch switch to support detached head