add head and set_head to Repo
fix duplicated refs issue