git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] git show <remote>: bad information: Local branch|ref configured

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Nov 13, 2010, 01:09 UTC
Message-ID
<20101113010934.GA4017@burratino>
In-Reply-To
<201011130041.oAD0fdmM017083@no.baka.org>
On Fri, Nov 12, 2010 at 07:41:39PM -0500, Seth Robertson wrote:
> Not having inspected the code, it certainly appears as if the "Local
> branch configured" and "Local ref configured" information is only
> accidentally correct, but since the normal configuration is the case
> in which it is accurate, no-one noticed the problem.

Funny. :) But no, lots of people set up local branches as downstream to no branch or to some distinct remote branch. So first I guess it might be useful to explain the "push matching" behavior.

Background: suppose the upstream repository has three branches:
	master
	next
	topic/better-frotz
Now I have an idea for a new feature, so I do
	git checkout -b topic/xyzzy origin/master
which forks a new branch set up to pull from master.

Now I go about usual work, making changes to master, next, topic/better-frotz, and so on, and at the end I am on my private topic/xyzzy branch. Everything looks good, so it is time to push:

	git push origin
This is a shortcut for
	git push origin :

which pushes all local branches for which an upstream branch with the same name exists.

"Wait!" you might ask.  "Why push all branches?"

It is partly historical. A lot of people have public repositories with multiple branches, and this is a behavior that has been found to be very convenient for that.

"Why only branches for which an upstream branch exists?"

Some work might be private. If you actually want to push everything, use "git push --mirror".

"Why branches with the same name? Why not to the branch each branch pulls from?"

Each branch forked from master does not necessarily contain changes that are suitable for inclusion in master immediately. In general, the upstream for each branch is often more stable rather than equally stable to it, so automatic pushing upstream does not always make sense.

However, if you want the push-to-where-you-pull-from behavior, just add

	[push]
		default = tracking
to your ~/.gitconfig.

See the documentation for branch.<name>.merge in git-config(1) for details on that.

For your test example: rather than sample output, could you describe next to each command what you expect to happen and how that differs from what happens instead? This would make it easier to find the lurking bugs.

Hope that helps, Jonathan

Previous: Seth RobertsonNext: Seth Robertson
Message 2 of 4 in “[BUG] git show <remote>: bad information: Local branch|ref configured”
  1. Seth RobertsonNov 13, 2010
  2. Jonathan NiederNov 13, 2010
  3. Seth RobertsonNov 13, 2010
  4. Jonathan NiederNov 13, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.