From 48a90d2b67187d871298e92e31de948de8740248 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sat, 17 Jun 2023 15:42:01 +0200 Subject: [PATCH] added 'tvd-stage-and-commit-current-buffer So now I can enter C-c g ('magit-file-dispatch) and from there press C which causes the current buffer to be staged and a commit be created in one run. --- lisp/init-magit.el | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lisp/init-magit.el b/lisp/init-magit.el index e2e1097..ac042c7 100644 --- a/lisp/init-magit.el +++ b/lisp/init-magit.el @@ -85,6 +85,16 @@ (transient-append-suffix 'magit-log "l" '("s" "dired" magit-dired-jump)) + ;; for a one file commit just do the stage+commit in 1 step just as + ;; with git commit -am + (defun tvd-stage-and-commit-current-buffer() + (interactive) + (magit-stage buffer-file-name) + (magit-commit-create)) + + (transient-append-suffix 'magit-file-dispatch "s" + '("C" "Stage+Commit" tvd-stage-and-commit-current-buffer)) + ;; after an exhausting discussion on magit#3139 I use this function ;; to (kind of) switch to another repository from inside magit-status. (defun tvd-switch-magit-repo ()