From ea0812f119d820b8dff9183258e1001d69b12b9b Mon Sep 17 00:00:00 2001 From: Hannu Koivisto Date: Sat, 24 Oct 2009 19:57:01 +0300 Subject: [PATCH] Add command magit-reset-head-hard. Intended to be bound to X instead of magit-reset-working-tree for those who feel it is a more consistent pair for x. Suggests HEAD and therefore works like magit-reset-working-tree by default. Eliminates need to use C-u x. --- magit.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/magit.el b/magit.el index 2bc69548..fb321f67 100644 --- a/magit.el +++ b/magit.el @@ -2418,10 +2418,16 @@ branch." (magit-run-git "reset" (if hard "--hard" "--soft") (magit-rev-to-git rev)))) +(defun magit-reset-head-hard (rev) + (interactive (list (magit-read-rev (format "Hard reset head to") + (or (magit-default-rev) + "HEAD")))) + (magit-reset-head rev t)) + (defun magit-reset-working-tree () (interactive) - (if (yes-or-no-p "Discard all uncommitted changes? ") - (magit-run-git "reset" "--hard"))) + (when (yes-or-no-p "Discard all uncommitted changes? ") + (magit-reset-head-hard "HEAD"))) ;;; Rewriting