From f9f358d564e77e12466318731498d6e67f3209a9 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Mon, 23 Sep 2024 05:53:52 +0200 Subject: emacs: Add magit option to ‘push all’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .config/emacs/init.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to '.config/emacs/init.el') diff --git a/.config/emacs/init.el b/.config/emacs/init.el index f3d10cd..3f01602 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -396,7 +396,20 @@ mode requires settings additional variables, those should be listed in (use-package magit :custom (magit-display-buffer-function - #'magit-display-buffer-same-window-except-diff-v1)) + #'magit-display-buffer-same-window-except-diff-v1) + :config + (transient-define-suffix x-magit-push-current-to-all-remotes (args) + "Push the current branch to all remotes." + :if #'magit-get-current-branch + (interactive (list (magit-push-arguments))) + (run-hooks 'magit-credential-hook) + (let ((branch (magit-get-current-branch))) + (dolist (remote (magit-list-remotes)) + (magit-run-git-async + "push" "-v" args remote + (format "refs/heads/%s:refs/heads/%s" branch branch))))) + (transient-append-suffix 'magit-push '(1 -1) + '("a" "all branches" x-magit-push-current-to-all-remotes))) (use-package magit-todos :after magit -- cgit v1.2.3