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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]