1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-31 02:01:13 +00:00
thefuck/thefuck/rules/git_pull.py
2017-08-31 17:58:56 +02:00

17 lines
473 B
Python

from thefuck.shells import shell
from thefuck.specific.git import git_support
@git_support
def match(command):
return 'pull' in command.script and 'set-upstream' in command.output
@git_support
def get_new_command(command):
line = command.output.split('\n')[-3].strip()
branch = line.split(' ')[-1]
set_upstream = line.replace('<remote>', 'origin')\
.replace('<branch>', branch)
return shell.and_(set_upstream, command.script)