When you push a branch with Magit (with P P
) and the branch has no
upstream, Magit asks you the name of the branch you want to push to.
That's great.
Once you set the upstream for a branch, however, Magit no longer asks you where you want to push it. This is usually convenient (you don't want to be asked every time), but it makes it difficult to push a branch to a different remote branch.
Is there a way to have Magit ask me again about the destination branch, even if the current branch already has an upstream?
Use-case
It's quite common that I have a branch like this:
Local: issue-30 ~/Git-Projects/repo/
Remote: issue-30 @ origin (git@github.com:.../repo.git)
Head: ebe4054 Some commit message
and I want to change both Local and Remote branches to issue-30-and-34
. If I just rename the Local branch, I'm left with this:
Local: issue-30-and-34 ~/Git-Projects/repo/
Remote: issue-30 @ origin (git@github.com:.../repo.git)
Head: ebe4054 Some commit message
Even if I delete origin/issue-30
, doing P P
on issue-30-and-34
will simply recreate the origin/issue-30
.
What I end up doing is the following, but it feels rather roundabout for something that can be done in a single git
command:
- Create a new branch called
issue-30-and-34
(instead of renaming the old one), - delete both Local and Remote versions of
issue-30
, - push
issue-30-and-34
(since it has no upstream yet, Magit will ask me where to push).