From 8ac4dafe6d89f0d405ca4acad140d75482a00dc4 Mon Sep 17 00:00:00 2001 From: mcarton Date: Tue, 12 May 2015 19:41:00 +0200 Subject: [PATCH] Add a git_stash rule --- README.md | 1 + thefuck/rules/git_stash.py | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 thefuck/rules/git_stash.py diff --git a/README.md b/README.md index d3016f9..ef74cc7 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,7 @@ using the matched rule and runs it. Rules enabled by default are as follows: * `git_checkout` – creates the branch before checking-out; * `git_no_command` – fixes wrong git commands like `git brnch`; * `git_push` – adds `--set-upstream origin $branch` to previous failed `git push`; +* `git_stash` – stashes you local modifications before rebase; * `has_exists_script` – prepends `./` when script/binary exists; * `lein_not_task` – fixes wrong `lein` tasks like `lein rpl`; * `mkdir_p` – adds `-p` when you trying to create directory without parent; diff --git a/thefuck/rules/git_stash.py b/thefuck/rules/git_stash.py new file mode 100644 index 0000000..a95d8f4 --- /dev/null +++ b/thefuck/rules/git_stash.py @@ -0,0 +1,7 @@ +def match(command, settings): + return ('git' in command.script + and 'Please commit or stash them.' in command.stderr) + + +def get_new_command(command, settings): + return 'git stash && ' + command.script