git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Wesarg <bert.wesarg@googlemail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [Q] push refspec with wildcard pushes all matching branches
Date: Sat, 25 Jan 2020 08:38:04 +0100	[thread overview]
Message-ID: <b4c31e50-6da5-7699-1069-d94091f768bd@googlemail.com> (raw)
In-Reply-To: <20200125003836.GA568952@coredump.intra.peff.net>



On 25.01.20 01:38, Jeff King wrote:
> On Fri, Jan 24, 2020 at 09:29:53PM +0100, Bert Wesarg wrote:
> 
>> I'm a little confused, that a push refspec with a wildcard changes the number of branches pushed.
> 
> I'm confused about which part you're confused about. :)
> 
>>      $ git push --dry-run
>>      To ../bare.git
>>       * [new branch]      master -> master
>>      $ git config remote.origin.push 'refs/heads/master*:refs/remotes/origin/master*'
>>      $ git push --dry-run
>>      To ../bare.git
>>       * [new branch]      master -> origin/master
>>       * [new branch]      master-two -> origin/master-two
>>
>> Is this expected behavior?
> 
> You asked it to push master*, so it did.
> 
> Is your confusion that you had set push.default to "current"? If there
> is a refspec (either in the config or specified on the command line),
> then that takes precedence over push.default.
> 
>  From git-push(1):
> 
>    When the command line does not specify what to push with <refspec>...
>    arguments or --all, --mirror, --tags options, the command finds the
>    default <refspec> by consulting remote.*.push configuration, and if it
>    is not found, honors push.default configuration to decide what to push
>    (See git-config(1) for the meaning of push.default).
> 
> If that's not it, can you clarify what you expected to happen?

thanks for this pointer. My initial pointer was the help for push.default:

  From git-config(1):

        push.default
            Defines the action git push should take if no refspec is explicitly
            given. Different values are well-suited for specific workflows; for

Thus I expected, that this takes effect, when just calling 'git push'.

What I actually want to achieve, is to track a remote branch with a different name locally, but 'git push' should nevertheless push to tracked remote branch.

In my example above, befor adding the 'push.origin.push' refspec, rename the branch:

     $ git branch -m local
     $ git push --dry-run
       To ../bare.git
        * [new branch]      local -> local

Is it possible that this pushes to the tracked branch automatically, and because I have multiple such branches, without the use of a push refspec.

Thanks for the help.

Best,
Bert

> 
> -Peff
> 

  reply	other threads:[~2020-01-25  7:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 20:29 [Q] push refspec with wildcard pushes all matching branches Bert Wesarg
2020-01-25  0:38 ` Jeff King
2020-01-25  7:38   ` Bert Wesarg [this message]
2020-01-25 20:05     ` [PATCH] doc: clarify "explicitly given" in push.default Jeff King
2020-01-27  7:00       ` Bert Wesarg
2020-01-27  7:02         ` Jeff King
2020-01-27  9:25           ` Bert Wesarg
2020-01-27 23:12             ` Jeff King
2020-01-28 22:11             ` Junio C Hamano
2020-01-29  2:41               ` Jeff King
2020-01-29  5:21                 ` Junio C Hamano
2020-01-29  5:53                   ` Jeff King
2020-01-27 19:48         ` Bert Wesarg
2020-01-27 20:53           ` Bert Wesarg
2020-01-27 23:14           ` Jeff King
2020-01-28 20:48             ` Bert Wesarg

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

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

  git send-email \
    --in-reply-to=b4c31e50-6da5-7699-1069-d94091f768bd@googlemail.com \
    --to=bert.wesarg@googlemail.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /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.
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 NNTP newsgroup(s).