In a way completely detached from those commands in Git, Magit displays this:

Head:     heroku-master Added curl-based test, GPG and bulk inserts
Merge:    heroku/master Added curl-based test, GPG and bulk inserts
Push:     github/heroku-master is missing

And in the branch popup:

Configure existing branches
 d branch.heroku-master.description unset
 u branch.heroku-master.merge       refs/heads/master
   branch.heroku-master.remote      heroku
 r branch.heroku-master.rebase      [true|false|pull.rebase:true]
 p branch.heroku-master.pushRemote  [github|heroku|remote.pushDefault:github]

Configure repository defaults
 M-r pull.rebase        [true|false|global:true]
 M-p remote.pushDefault [github|heroku]

Configure branch creation
 U branch.autoSetupMerge  [always|true|false|default:true]
 R branch.autoSetupRebase [always|local|remote|never|default:never]

And in push popup:

 -f Force (--force-with-lease)
 -h Disable hooks (--no-verify)
 -d Dry run (--dry-run)

Push heroku-master to
 p github/heroku-master
 u heroku/master
 e elsewhere

Why would I ever want to press p from this buffer? I.e. why would I ever not want to push to the tracked branch? And why is it called "push"?

Notice also how Git is set to always rebase and not merge, but Magit displays "Merge". And, again, this has nothing to do with merging in Git or with any sort of merging you can think of...

I've seen this answer: https://emacs.stackexchange.com/a/26248/563 and it contradicts what I see in the status buffer. So, is this a bug or yet another "useful" feature? Is there any way to get rid of it?

  • 'my question was more of "how to get rid of this junk?", and the why it is misnamed is just a curiosity' - consider giving a more relevant title then.
    – npostavs
    Jun 6, 2017 at 18:26
  • Okay everyone, this exchange got a bit too heated. Let's all cool off.
    – Dan
    Jun 7, 2017 at 4:49

2 Answers 2


Tarsius' answer already covers what it means and why it could be useful, but for completeness:

Is there any way to get rid of it?

(remove-hook 'magit-status-headers-hook #'magit-insert-upstream-branch-header)
(remove-hook 'magit-status-headers-hook #'magit-insert-push-branch-header)

This feature isn't "completely detached from those commands in Git". Git has this feature too, it is just hidden deep in the documentation. It also did not exist at the time the tutorials we all learned Git from, were written. So most Git users missed out on learning about it then, and most Git users haven't heard about it since. But it is very useful nonetheless.

Let's assume your local branch is cool-unfinished-feature. Eventually you want to merge that into master and then push master to origin/master. However you are not quite ready to do that yet, and meanwhile want to see a list of commits that are in cool-unfinished-features but not {origin/}master. Setting the upstream to one of these branches allows you to do so.

However you also want to push cool-unfinished-feature somewhere, so that others can review it, or, if you are not the maintainer, then you need to do that so that the maintainer can merge.

So you might set the upstream to my-fork/cool-unfinished-feature instead. This allows you to see what new commits on cool-unfinished-features you haven't pushed to my-fork/cool-unfinished-feature yet, i.e. what new additions others did not have a change to review yet. This also makes it easier to push to the ephemeral branch on the remote.

Unfortunately now you cannot see the full list of commits that have not been merged into origin/master yet anymore. Nor can you see the changes that have been made in the mainline, since you started working on your feature branch.

So you really want to be able to associate a feature branch with two related branches - (a) the branch into which it should eventually be merged (b) the public copy others can look at.

Git supports that. The upstream branch, which is configured using branch.<name>.remote and branch.<name>.merge should be used used for the "branch into which this should be merged eventually". And the push-remote should be used to configure where you want to push the ephemeral branch. This second mechanism only lets you specify the remote where you want to push the branch to, using branch.<name>.pushRemote or remote.pushDefault. The name of the remote branch is always the same on the remote as it is locally.

For a very few branches, e.g. master, the upstream and the push-remote usually refer to the same remote branch.

This is also discussed in the manual.

  • Your assumption falls apart at the very start: no, that's not useful, and no, I would never want to do anything like that and cannot see why anyone would. Git is 90% of useless features. And this one is a pinnacle of uselessness... I can accomplish this task in about ten different ways, I don't need the eleventh way to do this. Why bring this garbage into Magit? Anyways, my question was more of "how to get rid of this junk?", and the why it is misnamed is just a curiosity.
    – wvxvw
    Jun 6, 2017 at 6:02
  • 1
    As always with Magit, different people have different needs. I use this particular feature on a daily basis, and appreciate the heck out of it. I can also understand someone not needing it and even wishing to simplify the UI, but it's just silly to state that it's useless -- at minimum you can tell that it was useful enough to some people to warrant the effort being put into implementing the functionality in the first place.
    – phils
    Jun 6, 2017 at 10:34
  • 6
    @wvxvw You should learn to treat the maintainers of the software that you use with respect. You are unwilling and/or incapable to understand that just because you do see no need for something doesn't mean that it is a "pinnacle of uselessness" - and need to put a serious effort into changing that attitude. You had this discussion before. You think Git is mostly stupid and Magit should "fix" that. But Magit was written for users who like Git or at least do not think it is only 10% good. Please stop using Magit, it is not a suitable tool for you.
    – tarsius
    Jun 6, 2017 at 15:06
  • 3
    You have asked 5 questions about Magit so far. In 2 cases you were outright mean spirited and in 1 additional one slightly insulting. I will no longer answer your questions. emacs.stackexchange.com/questions/18924/… was about essentially the same issue, and there too you quickly became insulting (though later you deleted the insults).
    – tarsius
    Jun 6, 2017 at 15:10
  • I should act more professionally and simply ignore you, but your consistently insulting behavior makes that very hard. Here is a copy of your insults, in case you decide to remove the context, which would make my response look even worse>>
    – tarsius
    Jun 6, 2017 at 15:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.