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

Re: Using push.default with push.remote.push

From
RDRobert Dailey <rcdailey.lists@gmail.com>
Date
Mar 11, 2020, 15:43 UTC
Message-ID
<CAHd499DcLsffD6RHK2x-k3JWk4BtR-NLx_WnAYesz9d+w_m8AQ@mail.gmail.com>
In-Reply-To
<CAHd499BhLe0xF_k2ASV=ZuM7LVvxui_cxzB9UrJ2MDCyyNUmtw@mail.gmail.com>
On Wed, Mar 11, 2020 at 10:41 AM Robert Dailey <rcdailey.lists@gmail.com> wrote:
Show 40 quoted lines
>
> With the specified configuration:
>
> ```
> [push]
>     default = current
> [remote "origin"]
>     url = git@mydomain:myrepo
>     fetch = +refs/heads/dev/john/*:refs/remotes/origin/*
>     fetch = +refs/heads/*:refs/remotes/origin/*
>     push = refs/heads/master:refs/heads/master
>     push = refs/heads/*:refs/heads/dev/john/*
> ```
>
> Given a currently checked out local branch named `my-feature`, how can
> I make this command:
>
>     git push -n origin
>
> Behave semantically identical to this command?
>
>     git push -n origin my-feature
>
> The current behavior seems to be working as designed, but not as
> desired. The first push command pushes *all* branches under
> `refs/heads/*`, instead of just the current branch as it normally
> would via `push.default` setting. It sort of feels like if a resolved,
> explicitly defined `push.<remote>.push` config is found *and* it
> includes wildcards, the `push.default` setting should still be
> respected.
>
> Are there any workarounds to getting the behavior I'm looking for?
>
> Note my ultimate goal here is to transparently map local branches to a
> branch with a prefix on the remote. But I do not want to explicitly
> work with or see those prefixes locally. Basically
> `dev/john/my-feature` on the remote should be `refs/heads/my-feature`
> locally, and `refs/remotes/origin/my-feature` for fetches. The
> push-without-explicit-refspec case is the only one I haven't gotten to
> work as desired yet.
Correction:
`push.<remote>.push` above should have been `remote.<remote>.push`.
Previous: Robert DaileyNext: Jeff King
Message 2 of 6 in “Using push.default with push.remote.push”
  1. Robert DaileyMar 11, 2020
  2. Robert DaileyMar 11, 2020
  3. Jeff KingMar 11, 2020
  4. Robert DaileyMar 11, 2020
  5. Robert DaileyMar 11, 2020
  6. Jeff KingMar 11, 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.