git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Seth Robertson <in-gitvger@baka.org>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git show <remote>: bad information: Local branch|ref configured
Date: Fri, 12 Nov 2010 19:09:34 -0600	[thread overview]
Message-ID: <20101113010934.GA4017@burratino> (raw)
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

  reply	other threads:[~2010-11-13  1:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-13  0:41 [BUG] git show <remote>: bad information: Local branch|ref configured Seth Robertson
2010-11-13  1:09 ` Jonathan Nieder [this message]
2010-11-13  1:44   ` [BUG] git show <remote>: bad information: Local ref configured if push.default=tracking Seth Robertson
2010-11-13  4:46     ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101113010934.GA4017@burratino \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=in-gitvger@baka.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).