@cli.command()<EOL>@click.argument("<STR_LIT>", default="<STR_LIT>")<EOL>@pass_config<EOL>def branches(config, searchstring="<STR_LIT>"):
repo = config.repo<EOL>branches_ = list(find(repo, searchstring))<EOL>if branches_:<EOL><INDENT>merged = get_merged_branches(repo)<EOL>info_out("<STR_LIT>")<EOL>print_list(branches_, merged)<EOL>if len(branches_) == <NUM_LIT:1> and searchstring:<EOL><INDENT>active_branch = repo.active_branch<EOL>if active_branch == branches_[<NUM_LIT:0>]:<EOL><INDENT>error_out("<STR_LIT>".format(branches_[<NUM_LIT:0>].name))<EOL><DEDENT>branch_name = branches_[<NUM_LIT:0>].name<EOL>if len(branch_name) > <NUM_LIT:50>:<EOL><INDENT>branch_name = branch_name[:<NUM_LIT>] + "<STR_LIT>"<EOL><DEDENT>check_it_out = (<EOL>input("<STR_LIT>".format(branch_name)).lower().strip()<EOL>!= "<STR_LIT:n>"<EOL>)<EOL>if check_it_out:<EOL><INDENT>branches_[<NUM_LIT:0>].checkout()<EOL><DEDENT><DEDENT><DEDENT>elif searchstring:<EOL><INDENT>error_out("<STR_LIT>".format(searchstring))<EOL><DEDENT>else:<EOL><INDENT>error_out("<STR_LIT>")<EOL><DEDENT>
List all branches. And if exactly 1 found, offer to check it out.