Add git merge rule (#755)

This fixes https://github.com/nvbn/thefuck/issues/629
This commit is contained in:
David Hart
2018-01-02 16:47:48 +00:00
committed by Joseph Frazier
parent 897572d278
commit f700b23f57
3 changed files with 45 additions and 0 deletions
+18
View File
@@ -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)