How to use the thefuck.specific.git.git_support function in thefuck

To help you get started, we’ve selected a few thefuck examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nvbn / thefuck / thefuck / rules / git_branch_list.py View on Github external
@git_support
def match(command):
    # catches "git branch list" in place of "git branch"
    return (command.script_parts
            and command.script_parts[1:] == 'branch list'.split())
github nvbn / thefuck / thefuck / rules / git_pull.py View on Github external
@git_support
def get_new_command(command):
    line = command.output.split('\n')[-3].strip()
    branch = line.split(' ')[-1]
    set_upstream = line.replace('', 'origin')\
                       .replace('', branch)
    return shell.and_(set_upstream, command.script)
github nvbn / thefuck / thefuck / rules / git_rebase_no_changes.py View on Github external
@git_support
def match(command):
    return (
        {'rebase', '--continue'}.issubset(command.script_parts) and
        'No changes - did you forget to use \'git add\'?' in command.output
    )
github nvbn / thefuck / thefuck / rules / git_not_command.py View on Github external
@git_support
def match(command):
    return (" is not a git command. See 'git --help'." in command.output
            and ('The most similar command' in command.output
                 or 'Did you mean' in command.output))
github nvbn / thefuck / thefuck / rules / git_not_command.py View on Github external
@git_support
def get_new_command(command):
    broken_cmd = re.findall(r"git: '([^']*)' is not a git command",
                            command.output)[0]
    matched = get_all_matched_commands(command.output, ['The most similar command', 'Did you mean'])
    return replace_command(command, broken_cmd, matched)
github nvbn / thefuck / thefuck / rules / git_branch_exists.py View on Github external
@git_support
@eager
def get_new_command(command):
    branch_name = re.findall(
        r"fatal: A branch named '(.+)' already exists.", command.output)[0]
    branch_name = branch_name.replace("'", r"\'")
    new_command_templates = [['git branch -d {0}', 'git branch {0}'],
                             ['git branch -d {0}', 'git checkout -b {0}'],
                             ['git branch -D {0}', 'git branch {0}'],
                             ['git branch -D {0}', 'git checkout -b {0}'],
                             ['git checkout {0}']]
    for new_command_template in new_command_templates:
        yield shell.and_(*new_command_template).format(branch_name)
github nvbn / thefuck / thefuck / rules / git_add_force.py View on Github external
@git_support
def get_new_command(command):
    return replace_argument(command.script, 'add', 'add --force')
github nvbn / thefuck / thefuck / rules / git_stash.py View on Github external
@git_support
def get_new_command(command):
    formatme = shell.and_('git stash', '{}')
    return formatme.format(command.script)
github nvbn / thefuck / thefuck / rules / git_branch_exists.py View on Github external
@git_support
def match(command):
    return ("fatal: A branch named '" in command.output
            and "' already exists." in command.output)
github nvbn / thefuck / thefuck / rules / git_rm_local_modifications.py View on Github external
@git_support
def get_new_command(command):
    command_parts = command.script_parts[:]
    index = command_parts.index('rm') + 1
    command_parts.insert(index, '--cached')
    command_list = [u' '.join(command_parts)]
    command_parts[index] = '-f'
    command_list.append(u' '.join(command_parts))
    return command_list