#N/A: Add new git_branch_delete_checked_out rule (#985)

This commit is contained in:
Pablo Aguiar
2019-10-23 00:30:17 +02:00
committed by Vladimir Iakovlev
parent 0ccb34bde8
commit 80cfd6991d
3 changed files with 49 additions and 0 deletions
@@ -0,0 +1,19 @@
from thefuck.shells import shell
from thefuck.specific.git import git_support
from thefuck.utils import replace_argument
@git_support
def match(command):
return (
("branch -d" in command.script or "branch -D" in command.script)
and "error: Cannot delete branch '" in command.output
and "' checked out at '" in command.output
)
@git_support
def get_new_command(command):
return shell.and_("git checkout master", "{}").format(
replace_argument(command.script, "-d", "-D")
)