Jeff King <> writes:

> For instance, it looks like your @{publish} requires config like:
>   [branch "master"]
>   pushremote = foo
>   push = refs/heads/bar
> to operate. Setting "pushremote" affects what "git push" does; it will
> go to the "foo" remote.

OK, and the same thing would happen if branch.*.pushremote is not
set for any branch, but remote.pushdefault is set to 'foo', right?

> But the branch.master.push setting does not do
> anything to "git push".

I am not sure I understand this.  I thought that the desire behind
the branch.*.push is to allow something like:

        ... other things in the config ...
                pushdefault = foo
        [remote "foo"]
                url = ...
                push = +refs/heads/*:refs/remotes/satellite/*
                fetch = +refs/heads/*:refs/remotes/foo/*
        [branch "master"]
                ; pushremote = foo
                push = refs/heads/bar

so that "git push" on 'master' will override the more generic "all
local branches here will go to their remote-tracking hierarchy for
this satellite" refspec.  And in that sense branch.master.push would
do something to "git push".

I personally think that kind of override adds any more values than
it causes confusion, so I think it is OK not to support such uses of
branch.*.push at all.  A configuration without branch.master.push
may cause "git push" on 'master' to update refs/heads/master at the
remote, and if we fetched from 'foo' immediately after pushing
there, it would come back as refs/remotes/foo/master, and it would
be natural for users to expect that master@{publish} would be
refs/remotes/foo/master in such a case.

If we supported setting branch.master.push to refs/heads/bar, then
master would be pushed as refs/heads/bar over there and it would
come back as refs/remotes/foo/bar here, so I would expect that to be
the value of master@{publish}.

> Only a push refspec (or push.default setting)
> will change that. So the "branch.*.push" must be kept in sync manually
> (perhaps by running "git push -p").
> Whereas if @{publish} means "where you would push to", then
> "branch.*.push" does not need to exist at all. The values can be taken
> automatically from the other push settings.
> -Peff
> PS I first tried just setting "branch.master.pushremote" without setting
>    "branch.master.push". This results in a segfault, as branch_get()
>    assumes that push_name is always set and tries to xstrdup() it.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to