From e9132a53d425f7c4579f8f3b9c1445eaacff328f Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 6 Aug 2008 14:41:48 +0300 Subject: [PATCH] Resetting. --- magit.el | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/magit.el b/magit.el index 76b31d07..55d544ce 100644 --- a/magit.el +++ b/magit.el @@ -31,6 +31,7 @@ ;;; TODO +;; - Reverting ;; - Documentation, major mode, menu, ... ;; - History browsing ;; - Detect and handle renames and copies. @@ -178,6 +179,8 @@ (define-key magit-keymap (kbd "a") 'magit-stage-thing-at-point) (define-key magit-keymap (kbd "u") 'magit-unstage-thing-at-point) (define-key magit-keymap (kbd "i") 'magit-ignore-thing-at-point) + (define-key magit-keymap (kbd "x") 'magit-revert-thing-at-point) + (define-key magit-keymap (kbd "X") 'magit-reset-hard) (define-key magit-keymap (kbd "RET") 'magit-visit-thing-at-point) (define-key magit-keymap (kbd "b") 'magit-switch-branch) (define-key magit-keymap (kbd "B") 'magit-create-branch) @@ -393,6 +396,15 @@ (interactive (list (magit-read-other-branch "Merge from branch: "))) (magit-run "git" "merge" branch)) +;;; Resetting + +(defun magit-reset-hard (target) + (interactive (list (read-string "Hard reset to: " "HEAD"))) + (if (yes-or-no-p + (format "Hard reset to %s and throw away all uncommitted changes? " + target)) + (magit-run "git" "reset" "--hard" target))) + ;;; Push and pull (defun magit-pull ()