From 5504b905f39962e22a04227bc749391dc0806ed7 Mon Sep 17 00:00:00 2001 From: Vladimir Iakovlev Date: Sat, 26 Aug 2017 13:39:38 +0200 Subject: [PATCH] #682: Fix `git_push` rule in instant mode --- thefuck/rules/git_push.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/thefuck/rules/git_push.py b/thefuck/rules/git_push.py index 85f59fe..1f8e762 100644 --- a/thefuck/rules/git_push.py +++ b/thefuck/rules/git_push.py @@ -1,3 +1,4 @@ +import re from thefuck.utils import replace_argument from thefuck.specific.git import git_support @@ -32,5 +33,6 @@ def get_new_command(command): if len(command_parts) > upstream_option_index: command_parts.pop(upstream_option_index) - push_upstream = command.stderr.split('\n')[-3].strip().partition('git ')[2] - return replace_argument(" ".join(command_parts), 'push', push_upstream) + arguments = re.findall(r'git push (.*)', command.stderr)[0].strip() + return replace_argument(" ".join(command_parts), 'push', + 'push {}'.format(arguments))