spacemacs

Spacemacs docs: http://develop.spacemacs.org/doc/DOCUMENTATION.html http://develop.spacemacs.org/layers/+lang/clojure/README.html https://practicalli.github.io/spacemacs/
Mario C. 2020-06-17T18:47:28.455500Z

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)))

Mario C. 2020-06-17T18:48:32.456500Z

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

Mario C. 2020-06-17T18:51:37.456900Z

(defun compare-to-branch ()
    "Compare file in buffer to branch specified."
    (interactive)
    (letrec ((branch-name (read-string "Enter branch name: ")))
      (magit-file-dispatch)))

Mario C. 2020-06-17T19:12:50.457300Z

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)))