Commit 31088055 authored by Jonas Bernoulli's avatar Jonas Bernoulli

improve transfer popups and their actions

Improve the popups `magit-fetch-popup', `magit-pull-popup',
`magit-push-popup' and `magit-rebase-popup', and their actions.

Each popup feature three actions which acts on the current branch and
the push-remote, the upstream, or any other source or target.  Some of
these popups also feature other actions and continue to do so.

If one of the mentioned actions isn't usable, because the branch it is
supposed to act on is not currently configured, then it is hidden.  If
such a command is invoked while it is unusable, then that now results
in a user-error.

The commands are renamed and the bindings are changed, both to increase
consistency among these popups and to be make them more self-explanatory.
Three of these commands were previously missing.

                                p: `magit-fetch-from-pushremote'
  f: `magit-fetch-current'   => u: `magit-fetch-from-upstream'
  o: `magit-fetch'           => e: `magit-fetch'

                                p: `magit-pull-from-pushremote'
  F: `magit-pull-current'    => u: `magit-pull-from-upstream'
  o: `magit-pull'            => e: `magit-pull'

  Q: `magit-push-quickly'    => p: `magit-push-current-to-pushremote'
  P: `magit-push-current'    => u: `magit-push-current-to-upstream'
  e: `magit-push-elsewhere'  => e: `magit-push-current'

                                p: `magit-rebase-onto-pushremote'
  l: `magit-rebase-unpushed' => u: `magit-rebase-onto-upstream'
  r: `magit-rebase'          => e: `magit-rebase'

The bindings of some other actions were also adjusted.

  `magit-rebase-subset':      o => s
  `magit-rebase-edit-commit': e => m
parent 4d59336c
......@@ -3085,10 +3085,20 @@ Also see [[info:gitman#git-rebase]].
When no rebase is in progress, then the popup buffer features the
following commands.
- Key: r r, magit-rebase
- Key: r p, magit-rebase-onto-pushremote
Start a non-interactive rebase sequence. All commits not in
UPSTREAM are rebased.
Rebase the current branch onto ~branch.<name>.pushRemote~. If that
variable is unset, then rebase onto ~remote.pushDefault~.
- Key: r u, magit-rebase-onto-upstream
Rebase the current branch onto its upstream branch.
- Key: r e, magit-rebase
Rebase the current branch onto a branch read in the minibuffer. All
commits that are reachable from head but not from the selected
branch TARGET are being rebased."
- Key: r o, magit-rebase-subset
......@@ -3101,9 +3111,9 @@ This can be used to turn one of the above non-interactive rebase
variants into an interactive rebase.
For example if you want to clean up a feature branch and at the same
time rebase it onto ~master~, then you could use ~r-ir~. But we recommend
that you instead do that in two steps. First use ~rs~ to cleanup the
feature branch, and then in a second step ~rl~ to rebase it onto ~master~.
time rebase it onto ~master~, then you could use ~r-iu~. But we recommend
that you instead do that in two steps. First use ~ri~ to cleanup the
feature branch, and then in a second step ~ru~ to rebase it onto ~master~.
That way if things turn out to be more complicated than you thought
and/or you make a mistake and have to start over, then you only have
to redo half the work.
......@@ -3116,20 +3126,11 @@ is not enabled in the popup.
Start an interactive rebase sequence.
- Key: r l, magit-rebase-unpushed
Start an interactive rebase sequence of unpushed commits. This is
like ~magit-rebase-interactive~, but if the upstream of the current
branch is configured, then all commits since the merge-base are
rebased. If there is no upstream or no merge-base, then the user
has to select the first commit to be rebased like for
~magit-rebase-interactive~.
- Key: r f, magit-rebase-autosquash
Combine squash and fixup commits with their intended targets.
- Key: r e, magit-rebase-edit-commit
- Key: r m, magit-rebase-edit-commit
Edit a single older commit using rebase.
......@@ -3635,23 +3636,25 @@ Also see [[info:gitman#git-fetch]].
This prefix command shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
- Key: f f, magit-fetch-current
- Key: f p, magit-fetch-from-pushremote
Fetch from the push-remote of the current branch.
Fetch from the upstream repository of the current branch. If ~HEAD~
is detached or if the upstream is not configured, then read the
remote.
- Key: f u, magit-fetch-from-upstream
- Key: f o, magit-fetch
Fetch from the push-remote of the current branch.
- Key: f e, magit-fetch
Fetch from another repository.
- Key: f a, magit-fetch-all
Fetch from all configured remotes.
Fetch from all remotes.
- Key: f m, magit-submodule-fetch
Fetch all submodules. With a prefix argument fetch all remotes or
Fetch all submodules. With a prefix argument fetch all remotes of
all submodules.
** Pulling
......@@ -3660,16 +3663,20 @@ Also see [[info:gitman#git-pull]].
- Key: F, magit-pull-popup
This prefix command shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
This prefix command shows the following suffix commands in a popup
buffer.
- Key: F p, magit-pull-from-pushremote
Pull from the push-remote of the current branch.
- Key: F F, magit-pull-current
- Key: F u, magit-pull-from-upstream
Fetch and merge into current branch.
Pull from the upstream of the current branch.
- Key: F o, magit-pull
- Key: F e, magit-pull
Fetch from another repository and merge a fetched branch.
Pull from a branch read in the minibuffer.
** Pushing
......@@ -3680,18 +3687,16 @@ Also see [[info:gitman#git-push]].
This prefix command shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
- Key: P Q, magit-push-quickly
- Key: P p, magit-push-current-to-pushremote
Push the current branch to ~branch.<name>.pushRemote~. If that
variable is unset, then push to ~remote.pushDefault~. If that
variable is unset too, then raise an error.
Push the current branch to ~branch.<name>.pushRemote~ or if that
is unset to ~remote.pushDefault~.
- Key: P P, magit-push-current
- Key: P u, magit-push-current-to-upstream
Push the current branch to its upstream branch. If the upstream
isn't set, then read the remote branch.
Push the current branch to its upstream branch.
- Key: P e, magit-push-elsewhere
- Key: P e, magit-push-current
Push the current branch to a branch read in the minibuffer.
......
......@@ -4273,12 +4273,26 @@ When no rebase is in progress, then the popup buffer features the
following commands.
@table @asis
@kindex r r
@kindex r p
@cindex magit-rebase-onto-pushremote
@item @kbd{r p} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-onto-pushremote})
Rebase the current branch onto @code{branch.<name>.pushRemote}. If that
variable is unset, then rebase onto @code{remote.pushDefault}.
@kindex r u
@cindex magit-rebase-onto-upstream
@item @kbd{r u} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-onto-upstream})
Rebase the current branch onto its upstream branch.
@kindex r e
@cindex magit-rebase
@item @kbd{r r} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase})
@item @kbd{r e} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase})
Start a non-interactive rebase sequence. All commits not in
UPSTREAM are rebased.
Rebase the current branch onto a branch read in the minibuffer. All
commits that are reachable from head but not from the selected
branch TARGET are being rebased."
@kindex r o
@cindex magit-rebase-subset
......@@ -4294,9 +4308,9 @@ This can be used to turn one of the above non-interactive rebase
variants into an interactive rebase.
For example if you want to clean up a feature branch and at the same
time rebase it onto @code{master}, then you could use @code{r-ir}. But we recommend
that you instead do that in two steps. First use @code{rs} to cleanup the
feature branch, and then in a second step @code{rl} to rebase it onto @code{master}.
time rebase it onto @code{master}, then you could use @code{r-iu}. But we recommend
that you instead do that in two steps. First use @code{ri} to cleanup the
feature branch, and then in a second step @code{ru} to rebase it onto @code{master}.
That way if things turn out to be more complicated than you thought
and/or you make a mistake and have to start over, then you only have
to redo half the work.
......@@ -4312,26 +4326,15 @@ is not enabled in the popup.
Start an interactive rebase sequence.
@kindex r l
@cindex magit-rebase-unpushed
@item @kbd{r l} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-unpushed})
Start an interactive rebase sequence of unpushed commits. This is
like @code{magit-rebase-interactive}, but if the upstream of the current
branch is configured, then all commits since the merge-base are
rebased. If there is no upstream or no merge-base, then the user
has to select the first commit to be rebased like for
@code{magit-rebase-interactive}.
@kindex r f
@cindex magit-rebase-autosquash
@item @kbd{r f} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-autosquash})
Combine squash and fixup commits with their intended targets.
@kindex r e
@kindex r m
@cindex magit-rebase-edit-commit
@item @kbd{r e} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-edit-commit})
@item @kbd{r m} @tie{}@tie{}@tie{}@tie{}(@code{magit-rebase-edit-commit})
Edit a single older commit using rebase.
......@@ -5118,17 +5121,21 @@ the git-fetch(1) manpage
This prefix command shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
@kindex f f
@cindex magit-fetch-current
@item @kbd{f f} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch-current})
@kindex f p
@cindex magit-fetch-from-pushremote
@item @kbd{f p} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch-from-pushremote})
Fetch from the push-remote of the current branch.
Fetch from the upstream repository of the current branch. If @code{HEAD}
is detached or if the upstream is not configured, then read the
remote.
@kindex f u
@cindex magit-fetch-from-upstream
@item @kbd{f u} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch-from-upstream})
@kindex f o
Fetch from the push-remote of the current branch.
@kindex f e
@cindex magit-fetch
@item @kbd{f o} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch})
@item @kbd{f e} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch})
Fetch from another repository.
......@@ -5136,13 +5143,13 @@ Fetch from another repository.
@cindex magit-fetch-all
@item @kbd{f a} @tie{}@tie{}@tie{}@tie{}(@code{magit-fetch-all})
Fetch from all configured remotes.
Fetch from all remotes.
@kindex f m
@cindex magit-submodule-fetch
@item @kbd{f m} @tie{}@tie{}@tie{}@tie{}(@code{magit-submodule-fetch})
Fetch all submodules. With a prefix argument fetch all remotes or
Fetch all submodules. With a prefix argument fetch all remotes of
all submodules.
@end table
......@@ -5168,20 +5175,26 @@ the git-pull(1) manpage
@cindex magit-pull-popup
@item @kbd{F} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull-popup})
This prefix command shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
This prefix command shows the following suffix commands in a popup
buffer.
@kindex F F
@cindex magit-pull-current
@item @kbd{F F} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull-current})
@kindex F p
@cindex magit-pull-from-pushremote
@item @kbd{F p} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull-from-pushremote})
Fetch and merge into current branch.
Pull from the push-remote of the current branch.
@kindex F o
@kindex F u
@cindex magit-pull-from-upstream
@item @kbd{F u} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull-from-upstream})
Pull from the upstream of the current branch.
@kindex F e
@cindex magit-pull
@item @kbd{F o} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull})
@item @kbd{F e} @tie{}@tie{}@tie{}@tie{}(@code{magit-pull})
Fetch from another repository and merge a fetched branch.
Pull from a branch read in the minibuffer.
@end table
@node Pushing
......@@ -5209,24 +5222,22 @@ the git-push(1) manpage
This prefix command shows the following suffix commands along with
the appropriate infix arguments in a popup buffer.
@kindex P Q
@cindex magit-push-quickly
@item @kbd{P Q} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-quickly})
@kindex P p
@cindex magit-push-current-to-pushremote
@item @kbd{P p} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-current-to-pushremote})
Push the current branch to @code{branch.<name>.pushRemote}. If that
variable is unset, then push to @code{remote.pushDefault}. If that
variable is unset too, then raise an error.
Push the current branch to @code{branch.<name>.pushRemote} or if that
is unset to @code{remote.pushDefault}.
@kindex P P
@cindex magit-push-current
@item @kbd{P P} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-current})
@kindex P u
@cindex magit-push-current-to-upstream
@item @kbd{P u} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-current-to-upstream})
Push the current branch to its upstream branch. If the upstream
isn't set, then read the remote branch.
Push the current branch to its upstream branch.
@kindex P e
@cindex magit-push-elsewhere
@item @kbd{P e} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-elsewhere})
@cindex magit-push-current
@item @kbd{P e} @tie{}@tie{}@tie{}@tie{}(@code{magit-push-current})
Push the current branch to a branch read in the minibuffer.
......
......@@ -108,26 +108,40 @@ Then show the status buffer for the new repository."
"Popup console for fetch commands."
'magit-commands
:man-page "git-fetch"
:switches '((?p "Prune" "--prune"))
:actions '((?f "Current" magit-fetch-current)
(?o "Other" magit-fetch)
(?a "All" magit-fetch-all)
(?m "Submodules" magit-submodule-fetch))
:default-action 'magit-fetch-current)
:switches '((?p "Prune deleted branches" "--prune"))
:actions '("Fetch from"
(?p magit-get-push-remote magit-fetch-from-pushremote)
(?u magit-get-tracked-remote magit-fetch-from-upstream)
(?e "elsewhere" magit-fetch)
(?a "all remotes" magit-fetch-all)
"Fetch"
(?m "submodules" magit-submodule-fetch))
:default-action 'magit-fetch
:max-action-columns 1)
(defun magit-git-fetch (remote args)
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "fetch" remote args))
;;;###autoload
(defun magit-fetch-current (remote args)
"Fetch from the upstream repository of the current branch.
If `HEAD' is detached or if the upstream is not configured,
then read the remote."
(interactive (list (or (magit-get-remote)
(magit-read-remote "Fetch remote"))
(magit-fetch-arguments)))
(magit-git-fetch remote args))
(defun magit-fetch-from-pushremote (args)
"Fetch from the push-remote of the current branch."
(interactive (list (magit-fetch-arguments)))
(--if-let (magit-get-remote)
(magit-git-fetch it args)
(-if-let (magit-get-current-branch)
(user-error "No push-remote is configured for %s" it)
(user-error "No branch is checked out"))))
;;;###autoload
(defun magit-fetch-from-upstream (args)
"Fetch from the upstream repository of the current branch."
(interactive (list (magit-fetch-arguments)))
(--if-let (magit-get-remote)
(magit-git-fetch it args)
(-if-let (magit-get-current-branch)
(user-error "No upstream is configured for %s" it)
(user-error "No branch is checked out"))))
;;;###autoload
(defun magit-fetch (remote args)
......@@ -138,7 +152,7 @@ then read the remote."
;;;###autoload
(defun magit-fetch-all (args)
"Fetch from all configured remotes."
"Fetch from all remotes."
(interactive (list (magit-fetch-arguments)))
(run-hooks 'magit-credential-hook)
(magit-run-git-async-no-revert "remote" "update" args))
......@@ -151,9 +165,18 @@ then read the remote."
'magit-commands
:man-page "git-pull"
:switches '((?r "Rebase" "--rebase"))
:actions '((?F "Current" magit-pull-current)
(?o "Other" magit-pull))
:default-action 'magit-pull-current)
:actions '((lambda ()
(--if-let (magit-get-current-branch)
(concat
(propertize "Pull into " 'face 'magit-popup-heading)
(propertize it 'face 'magit-branch-local)
(propertize " from" 'face 'magit-popup-heading))
(propertize "Pull from" 'face 'magit-popup-heading)))
(?p magit-get-push-branch magit-pull-from-pushremote)
(?u magit-get-tracked-branch magit-pull-from-upstream)
(?e "elsewhere" magit-pull))
:default-action 'magit-pull
:max-action-columns 1)
(defun magit-git-pull (source args)
(run-hooks 'magit-credential-hook)
......@@ -162,16 +185,28 @@ then read the remote."
(magit-run-git-with-editor "pull" args remote branch)))
;;;###autoload
(defun magit-pull-current (source args)
"Fetch and merge into current branch."
(interactive (list (or (magit-get-tracked-branch)
(magit-read-remote-branch "Pull" nil nil nil t))
(magit-pull-arguments)))
(magit-git-pull source args))
(defun magit-pull-from-pushremote (args)
"Pull from the push-remote of the current branch."
(interactive (list (magit-pull-arguments)))
(--if-let (magit-get-push-branch)
(magit-git-pull it args)
(--if-let (magit-get-current-branch)
(user-error "No push-remote is configured for %s" it)
(user-error "No branch is checked out"))))
;;;###autoload
(defun magit-pull-from-upstream (args)
"Pull from the upstream of the current branch."
(interactive (list (magit-pull-arguments)))
(--if-let (magit-get-tracked-branch)
(magit-git-pull it args)
(-if-let (magit-get-current-branch)
(user-error "No upstream is configured for %s" it)
(user-error "No branch is checked out"))))
;;;###autoload
(defun magit-pull (source args)
"Fetch from another repository and merge a fetched branch."
"Pull from a branch read in the minibuffer."
(interactive (list (magit-read-remote-branch "Pull" nil nil nil t)
(magit-pull-arguments)))
(magit-git-pull source args))
......@@ -187,15 +222,20 @@ then read the remote."
(?h "Disable hooks" "--no-verify")
(?d "Dry run" "--dry-run")
(?u "Set upstream" "--set-upstream"))
:actions '((?P "Current" magit-push-current)
(?Q "Quickly" magit-push-quickly)
(?t "Tags" magit-push-tags)
(?o "Other" magit-push)
(?m "Matching" magit-push-matching)
(?T "Tag" magit-push-tag)
(?e "Elsewhere" magit-push-elsewhere))
:default-action 'magit-push-current
:max-action-columns 3)
:actions '((lambda ()
(--when-let (magit-get-current-branch)
(concat (propertize "Push " 'face 'magit-popup-heading)
(propertize it 'face 'magit-branch-local)
(propertize " to" 'face 'magit-popup-heading))))
(?p magit-get-push-branch magit-push-current-to-pushremote)
(?u magit-get-tracked-branch magit-push-current-to-upstream)
(?e "elsewhere" magit-push-current)
"Push"
(?o "another branch" magit-push)
(?T "a tag" magit-push-tag)
(?m "matching branches" magit-push-matching)
(?t "all tags" magit-push-tags))
:max-action-columns 2)
(defun magit-git-push (branch target args)
(run-hooks 'magit-credential-hook)
......@@ -206,10 +246,9 @@ then read the remote."
branch target))))
;;;###autoload
(defun magit-push-quickly (args)
(defun magit-push-current-to-pushremote (args)
"Push the current branch to `branch.<name>.pushRemote'.
If that variable is unset, then push to `remote.pushDefault'.
If that variable is unset too, then raise an error."
If that variable is unset, then push to `remote.pushDefault'."
(interactive (list (magit-push-arguments)))
(--if-let (magit-get-current-branch)
(-if-let (remote (magit-get-push-remote it))
......@@ -220,32 +259,25 @@ If that variable is unset too, then raise an error."
(user-error "No branch is checked out")))
;;;###autoload
(defun magit-push-current (branch target args)
"Push the current branch to its upstream branch.
If the upstream isn't set, then read the remote branch."
(interactive (list (magit-get-current-branch)
(magit-get-tracked-branch)
(magit-push-arguments)))
(cond ((and branch target)
(magit-git-push branch target args))
(branch
(call-interactively 'magit-push-elsewhere))
(t
(call-interactively 'magit-push))))
(defun magit-push-current-to-upstream (args)
"Push the current branch to its upstream branch."
(interactive (list (magit-push-arguments)))
(--if-let (magit-get-current-branch)
(-if-let (target (magit-get-tracked-branch it))
(magit-git-push it target args)
(user-error "No upstream is configured for %s" it))
(user-error "No branch is checked out")))
;;;###autoload
(defun magit-push-elsewhere (branch target args)
(defun magit-push-current (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)
(--if-let (magit-get-current-branch)
(list (magit-read-remote-branch (format "Push %s to" it)
nil nil it 'confirm)
(magit-push-arguments))
(list nil nil nil)))
(if (and branch target)
(magit-git-push branch target args)
(call-interactively 'magit-push)))
(user-error "No branch is checked out")))
(magit-git-push (magit-get-current-branch) target args))
;;;###autoload
(defun magit-push (source target args)
......
......@@ -291,20 +291,26 @@ This discards all changes made since the sequence started."
"Key menu for rebasing."
'magit-commands
:man-page "git-rebase"
:switches '((?k "Keep empty commits" "--keep-empty")
(?p "Preserve merges" "--preserve-merges")
:switches '((?k "Keep empty commits" "--keep-empty")
(?p "Preserve merges" "--preserve-merges")
(?c "Lie about author date" "--committer-date-is-author-date")
(?a "Autosquash" "--autosquash")
(?A "Autostash" "--autostash")
(?i "Interactive" "--interactive"))
:actions '((?r "Rebase" magit-rebase)
(?f "Autosquash" magit-rebase-autosquash)
(?o "Rebase subset" magit-rebase-subset)
nil
(?i "Rebase interactive" magit-rebase-interactive)
(?e "Edit commit" magit-rebase-edit-commit)
(?l "Rebase unpushed" magit-rebase-unpushed)
(?w "Reword commit" magit-rebase-reword-commit))
(?a "Autosquash" "--autosquash")
(?A "Autostash" "--autostash")
(?i "Interactive" "--interactive"))
:actions '((lambda ()
(concat (propertize "Rebase " 'face 'magit-popup-heading)
(propertize (or (magit-get-current-branch) "HEAD")
'face 'magit-branch-local)
(propertize " onto" 'face 'magit-popup-heading)))
(?p magit-get-push-branch magit-rebase-onto-pushremote)
(?u magit-get-tracked-branch magit-rebase-onto-upstream)
(?e "elsewhere" magit-rebase)
"Rebase"
(?i "interactively" magit-rebase-interactive)
(?m "to edit a commit" magit-rebase-edit-commit)
(?s "subset" magit-rebase-subset)
(?w "to reword a commit" magit-rebase-reword-commit) nil
(?f "to autosquash" magit-rebase-autosquash))
:sequence-actions '((?r "Continue" magit-rebase-continue)
(?s "Skip" magit-rebase-skip)
(?e "Edit" magit-rebase-edit)
......@@ -316,21 +322,44 @@ This discards all changes made since the sequence started."
(magit-run-git-sequencer "rebase" target args))
;;;###autoload
(defun magit-rebase (upstream args)
"Start a non-interactive rebase sequence.
All commits not in UPSTREAM are rebased."
(defun magit-rebase-onto-pushremote (args)
"Rebase the current branch onto `branch.<name>.pushRemote'.
If that variable is unset, then rebase onto `remote.pushDefault'."
(interactive (list (magit-rebase-arguments)))
(--if-let (magit-get-current-branch)
(-if-let (remote (magit-get-push-remote it))
(if (member remote (magit-list-remotes))
(magit-git-rebase (concat remote "/" it) args)
(user-error "Remote `%s' doesn't exist" remote))
(user-error "No push-remote is configured for %s" it))
(user-error "No branch is checked out")))
;;;###autoload
(defun magit-rebase-onto-upstream (args)
"Rebase the current branch onto its upstream branch."
(interactive (list (magit-rebase-arguments)))
(--if-let (magit-get-current-branch)
(-if-let (target (magit-get-tracked-branch it))
(magit-git-rebase target args)
(user-error "No upstream is configured for %s" it))
(user-error "No branch is checked out")))
;;;###autoload
(defun magit-rebase (target args)
"Rebase the current branch onto a branch read in the minibuffer.
All commits that are reachable from head but not from the
selected branch TARGET are being rebased."
(interactive (list (magit-read-other-branch-or-commit
"Rebase onto"
(magit-get-current-branch)
(magit-get-tracked-branch))
(magit-get-current-branch))
(magit-rebase-arguments)))
(message "Rebasing...")
(magit-git-rebase upstream args)
(magit-git-rebase target args)
(message "Rebasing...done"))
;;;###autoload
(defun magit-rebase-subset (newbase start args)
"Start a non-interactive rebase sequence.
"Rebase a subset of the current branches history onto a new base.
Rebase commits from START to `HEAD' onto NEWBASE.
START has to be selected from a list of recent commits."
(interactive (list (magit-read-other-branch-or-commit
......@@ -386,19 +415,12 @@ START has to be selected from a list of recent commits."
(magit-rebase-interactive-1 commit args
"Type %p on a commit to rebase it and all commits above it,"))
;;;###autoload
(defun magit-rebase-unpushed (args)
"Start an interactive rebase sequence of all unpushed commits."
(interactive (list (magit-rebase-arguments)))
(magit-rebase-interactive-1 :merge-base args
"Type %p on a commit to rebase it and all commits above it,"))
;;;###autoload
(defun magit-rebase-autosquash (args)
"Combine squash and fixup commits with their intended targets."
(interactive (list (magit-rebase-arguments)))
(magit-rebase-interactive-1 :merge-base (cons "--autosquash" args)
"Type %p on a commit to squash into it and the commits above it,"
"Type %p on a commit to squash into it and then rebase as necessary,"
"true"))
;;;###autoload
......
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