From d33c6048a5fa39bf6240e819116240b51135ef4e Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Wed, 6 Feb 2008 16:59:07 +0100 Subject: Add gitsum-amend, bound to A --- gitsum.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gitsum.el b/gitsum.el index f62687c..d19210c 100644 --- a/gitsum.el +++ b/gitsum.el @@ -12,7 +12,8 @@ (eval-when-compile (require 'cl)) (easy-mmode-defmap gitsum-diff-mode-shared-map - '(("c" . gitsum-commit) + '(("A" . gitsum-amend) + ("c" . gitsum-commit) ("g" . gitsum-refresh) ("P" . gitsum-push) ("R" . gitsum-revert) @@ -81,6 +82,17 @@ A numeric argument serves as a repeat count." (goto-char (point-min))) (log-edit 'gitsum-do-commit nil nil buffer))) +(defun gitsum-amend () + "Amend the last commit." + (interactive) + (let ((last (substring (shell-command-to-string + "git log -1 --pretty=oneline --abbrev-commit") + 0 -1))) + (when (y-or-n-p (concat "Are you sure you want to amend to " last "? ")) + (shell-command-on-region (point-min) (point-max) "git apply --cached") + (shell-command "git commit --amend -C HEAD") + (gitsum-refresh)))) + (defun gitsum-push () "Push the current repository." (interactive) -- cgit 1.4.1