Skip to content

Commit

Permalink
Add gitsum-amend, bound to A
Browse files Browse the repository at this point in the history
  • Loading branch information
leahneukirchen committed Feb 6, 2008
1 parent a860615 commit d33c604
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion gitsum.el
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d33c604

Please sign in to comment.