Add my/magit-stage-and-commit-file

This commit is contained in:
David Morgan 2023-05-17 12:56:42 +01:00
parent 69faf78c28
commit 119fda8cc0
Signed by: djm
GPG Key ID: C171251002C200F2
1 changed files with 7 additions and 0 deletions

View File

@ -74,6 +74,7 @@
("C-c g u" . my/magit-set-upstream)
("C-c g r" . my/magit-refresh-state)
("C-c g m" . my/magit-update-master)
("C-c g C-c" . my/magit-stage-and-commit-file)
:config
;; Requires the following gitconfig:
;; [alias]
@ -112,6 +113,12 @@
(magit-shell-command-topdir command)))
(message "Not a git repository")))
(defun my/magit-stage-and-commit-file ()
"Stage and commit the current the currently visited file."
(interactive)
(magit-stage-file (magit-file-relative-name))
(magit-commit-create))
;; difftastic code copied from https://tsdh.org/posts/2022-08-01-difftastic-diffing-with-magit.html
(defun my/magit--with-difftastic (buffer command)
"Run COMMAND with GIT_EXTERNAL_DIFF=difft then show result in BUFFER."