Add git merge rule (#755)
This fixes https://github.com/nvbn/thefuck/issues/629
This commit is contained in:
committed by
Joseph Frazier
parent
897572d278
commit
f700b23f57
@@ -0,0 +1,18 @@
|
||||
import re
|
||||
from thefuck.utils import replace_argument
|
||||
from thefuck.specific.git import git_support
|
||||
|
||||
|
||||
@git_support
|
||||
def match(command):
|
||||
return ('merge' in command.script
|
||||
and ' - not something we can merge' in command.output
|
||||
and 'Did you mean this?' in command.output)
|
||||
|
||||
|
||||
@git_support
|
||||
def get_new_command(command):
|
||||
unknown_branch = re.findall(r'merge: (.+) - not something we can merge', command.output)[0]
|
||||
remote_branch = re.findall(r'Did you mean this\?\n\t([^\n]+)', command.output)[0]
|
||||
|
||||
return replace_argument(command.script, unknown_branch, remote_branch)
|
||||
Reference in New Issue
Block a user