I use this command to compare the file in my current buffer to the same file on another branch. C-c M-g D r
after typing that out I can enter a branch name. Id like to map that command into SPC o g d
in which it will then allow me to enter the branch name. How can I do this? I have something like this so far.
(spacemacs/set-leader-keys "ogd" 'compare-to-branch)
And
(defun compare-to-branch ()
"Compare file in buffer to branch specified."
(interactive)
(letrec ((profile (read-string "Enter branch name: "))
(lein-params (concat "with-profile " profile " repl :headless")))
(message "lein-params set to: %s" lein-params)
(set-variable 'cider-lein-parameters lein-params)))
The compare-to-branch
is a copy n paste from another function in there which is why there is unrelated code. I want to see what changes I need to accomplish what I'd like to do
(defun compare-to-branch ()
"Compare file in buffer to branch specified."
(interactive)
(letrec ((branch-name (read-string "Enter branch name: ")))
(magit-file-dispatch)))
I got it working with this
(defun compare-to-branch ()
"Compare file in buffer to branch specified."
(interactive)
(letrec ((branch-name (read-string "Enter branch name: ")))
(magit-diff-range branch-name)))