Extract ref switcher into a partial

王权利请求将github/fork/rspeicher/ref_switch合并到master

Created by: rspeicher

Doesn't fix #1452 (closed), but that's the next step.

合并请求报告