Commit e3413aa9 authored by Jonas Bernoulli's avatar Jonas Bernoulli

magit-push-elsewhere: always push the current branch

Previously this command let the user choose what branch to push;
now `magit-push' should be used for that.

If HEAD is detached, then fallback to `magit-push'.  That is a
temporary approach, eventually this command will raise an error
in that case.
parent 3164aae4
......@@ -3689,8 +3689,7 @@ Also see [[info:gitman#git-push]].
- Key: P e, magit-push-elsewhere
Push a branch or commit to some remote branch. Read the local and
remote branch.
Push the current branch to a branch read in the minibuffer.
- Key: P o, magit-push
......
......@@ -5226,8 +5226,7 @@ isn't set, then read the remote branch.
@cindex magit-push-elsewhere
@item @kbd{P e} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-elsewhere})
Push a branch or commit to some remote branch. Read the local and
remote branch.
Push the current branch to a branch read in the minibuffer.
@kindex P o
@cindex magit-push
......
......@@ -231,10 +231,17 @@ If the upstream isn't set, then read the remote branch."
;;;###autoload
(defun magit-push-elsewhere (branch target args)
"Push a branch or commit to some remote branch.
Read the local and remote branch."
(interactive (magit-push-read-args nil nil t))
(magit-git-push branch target args))
"Push the current branch to a branch read in the minibuffer."
(interactive
(-if-let (branch (magit-get-current-branch))
(list branch
(magit-read-remote-branch (format "Push %s to" branch)
nil nil branch 'confirm)
(magit-push-arguments))
(list nil nil nil)))
(if (and branch target)
(magit-git-push branch target args)
(call-interactively 'magit-push)))
;;;###autoload
(defun magit-push (source target args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment