added optional sha argument to branch.write