[PATCH 1/1] Add command magit-reset-head-hard.

11 views
Skip to first unread message

Hannu Koivisto

unread,
Oct 24, 2009, 12:57:01 PM10/24/09
to ma...@googlegroups.com
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 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/magit.el b/magit.el
index a319dba..790afc3 100644
--- a/magit.el
+++ b/magit.el
@@ -2226,10 +2226,16 @@ in log buffer."
(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

--
1.6.4.GIT


Reply all
Reply to author
Forward
0 new messages