diff --git a/tests/rules/test_git_checkout.py b/tests/rules/test_git_checkout.py index 4ef56ea3..c72b1dcb 100644 --- a/tests/rules/test_git_checkout.py +++ b/tests/rules/test_git_checkout.py @@ -59,7 +59,7 @@ def test_get_branches(branches, branch_list, git_branch): ['git checkout -b unknown']), (b'', Command('git commit unknown', did_not_match('unknown')), - 'git branch unknown && git commit unknown'), + ['git branch unknown && git commit unknown']), (b' test-random-branch-123', Command('git checkout tst-rdm-brnch-123', did_not_match('tst-rdm-brnch-123')), diff --git a/thefuck/rules/git_checkout.py b/thefuck/rules/git_checkout.py index 8d2730bb..e4879731 100644 --- a/thefuck/rules/git_checkout.py +++ b/thefuck/rules/git_checkout.py @@ -42,9 +42,8 @@ def get_new_command(command): if command.script_parts[1] == 'checkout': new_commands.append(replace_argument(command.script, 'checkout', 'checkout -b')) - if new_commands: - return new_commands - else: - # if neither the better options above match, then resort to this - return shell.and_('git branch {}', '{}').format( - missing_file, command.script) + if not new_commands: + new_commands.append(shell.and_('git branch {}', '{}').format( + missing_file, command.script)) + + return new_commands