git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [Q] push refspec with wildcard pushes all matching branches

From
Jeff King <peff@peff.net>
Date
Jan 25, 2020, 00:38 UTC
Message-ID
<20200125003836.GA568952@coredump.intra.peff.net>
In-Reply-To
<ed9a0485-1e6c-79ae-6a59-655105203728@googlemail.com>
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. :)
Show 10 quoted lines
>     $ 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?
-Peff
Previous: Bert WesargNext: Bert Wesarg
Message 2 of 16 in “[Q] push refspec with wildcard pushes all matching branches”
  1. Bert WesargJan 24, 2020
  2. Jeff KingJan 25, 2020
  3. Bert WesargJan 25, 2020
  4. doc: clarify "explicitly given" in push.defaultJeff King, Jan 25, 2020
  5. Bert WesargJan 27, 2020
  6. Jeff KingJan 27, 2020
  7. doc: clarify "explicitly given" in push.defaultBert Wesarg, Jan 27, 2020
  8. Jeff KingJan 27, 2020
  9. Junio C HamanoJan 28, 2020
  10. Jeff KingJan 29, 2020
  11. Junio C HamanoJan 29, 2020
  12. Jeff KingJan 29, 2020
  13. Bert WesargJan 27, 2020
  14. Bert WesargJan 27, 2020
  15. Jeff KingJan 27, 2020
  16. Bert WesargJan 28, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.