from typing import List
from typing import Tuple
import re


def sortBranches(branches: List[str]) -> List[str]:
    """
    Alphabetically sorts the branches, but if there are numbers will
    numerically sort so:
    ['branch10', 'branch2'] -> ['branch2', 'branch10']
    """
    def splitByNumber(br: str) -> Tuple:
        match = re.search('(\D+)(\d+)(.*)', br)
        if match is None:
            return (br,)
        return match.group(1), int(match.group(2)), match.group(3)

    splitBranches = map(splitByNumber, branches)
    return [''.join(map(str, tup)) for tup in sorted(splitBranches)]