diff --git a/git-link.el b/git-link.el index dc5e44f1..a5d8cb2f 100644 --- a/git-link.el +++ b/git-link.el @@ -35,6 +35,9 @@ ;;; Change Log: +;; 2024-11-03 - v0.9.3 +;; * Add support for linking to a different branch with git-link-diffrent-branch (@dotemacs) +;; ;; 2024-06-29 - v0.9.2 ;; * Add git-link-add-to-kill-ring to not add to kill ring (thanks Michael Hauser-Raspe) ;; * Add prefix arg to open in browser when calling git-link-homepage (thanks Sibi Prabakaran) @@ -852,6 +855,24 @@ shown via annotate in bitbucket." "annotate" "src"))) +;;;###autoload +(defun git-link-different-branch (branch) + "Invoke `git-link', but with the `branch' name set to a different +branch than the one you're currently working on." + (interactive "P") + (let* ((default-remote-branch-name (magit-main-branch)) + (git-link-current-branch-setting git-link-default-branch) + (git-link-default-branch (if branch + (completing-read + (format "Instead of '%s' branch replace with branch: " (git-link--branch)) + (mapcar (lambda (branch) + (replace-regexp-in-string "^refs/heads/" "" branch)) + (magit-list-local-branches))) + default-remote-branch-name))) + (setq current-prefix-arg nil) + (call-interactively 'git-link) + (setq git-link-default-branch git-link-current-branch-setting))) + ;;;###autoload (defun git-link (remote start end) "Create a URL representing the current buffer's location in its