Implement branch_exists so we can decide whether or not to create a branch in write_study