current_head = get_head()
set_head_file(new_branch)
__set_head(current_head)
# a checkout isn't needed if new branch points to the current head
if tree_id:
current_head = get_head()
set_head_file(new_branch)
__set_head(current_head)
# a checkout isn't needed if new branch points to the current head
if tree_id: