Ramkumar Ramachandra <artag...@gmail.com> writes:

> [+CC: jc, jk]
> Leandro Lucarella wrote:
>> I changed branch.master.remote to upstream and set
>> branch.master.pushremote to origin, but when I do I git push I get an
>> error:
>> $ git push --dry-run --verbose
>> fatal: You are pushing to remote 'origin', which is not the upstream of
>> your current branch 'master', without telling me what to push
>> to update which remote branch.
> Yes, this is a defect: both remote.pushdefault and
> branch.<name>.pushremote suffer from it.

The upstream and simple modes have been defined to push to
"upstream" repository in central-shared-repository workflow.

At this point in Leandro's example, I think the configuration is:

        [branch "master"]
                remote = upstream
                merge = refs/heads/master
                pushremote = origin

and master@{u} == upstream's master, not origin's.

This shows the "triangular" support in 1.8.3 is only half-finished;
the other half was discussed a few weeks ago ($gmane/224604), but I
do not recall what the current status of the topic is.  I personally
think 'single' the root level of the thread hints is an overkill
mechanism, so here is a suggestion to show one possible way forward.

Until the branch.$name.push mechanism is introduced to specify which
destination branch is updated by the push, and/or branch.$name.push
is not specified after such a mechanism is introduced, I think the
natural extension of the current end-user configuration would be to
redefine "upstream" mode to push to update the branch with the same
name (in the above example, 'master' of 'origin' is updated), when
the "repository that is pushed to, which is different from the
repository that is fetched from" is specified via remote.pushdefault
or branch.$name.pushremote mechanisms.

This incidentally covers "simple" mode, because "pushing to update
the branch with the same name" is the only behaviour accepted by the
mode anyway.

When branch.$name.push mechanism is introduced and the user uses it,
then "upstream", "simple", or any other setting for that matter
would be ignored.  With

        [branch "master"]
                remote = upstream
                merge = refs/heads/master
                pushremote = origin
                push = refs/heads/master

it is clear that "git push" while on 'master' should push to origin
to update its master branch.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to