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

Re: [RFC/PATCH 1/2] remote tracking: return the tracking branch for the given branches

From
Jakub Narebski <jnareb@gmail.com>
Date
Jun 18, 2009, 13:44 UTC
Message-ID
<m3iqithd24.fsf@localhost.localdomain>
In-Reply-To
<adf1fd3d0906180622n25169f51n6aa249e9167cbc38@mail.gmail.com>
Santi Béjar <santi@agolina.net> writes:
Show 39 quoted lines
> 2009/6/18 Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>> On Thu, 18 Jun 2009, Santi Béjar wrote:
>>
>>> diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
>>> index 9e2b4ea..e444899 100644
>>> --- a/Documentation/git-remote.txt
>>> +++ b/Documentation/git-remote.txt
>>> @@ -17,6 +17,7 @@ SYNOPSIS
>>>  'git remote show' [-n] <name>
>>>  'git remote prune' [-n | --dry-run] <name>
>>>  'git remote update' [-p | --prune] [group | remote]...
>>> +'git remote tracking' <name> <branch>...
>>>
>>>  DESCRIPTION
>>>  -----------
>>> @@ -128,6 +129,12 @@ be updated.  (See linkgit:git-config[1]).
>>>  +
>>>  With `--prune` option, prune all the remotes that are updated.
>>>
>>> +'tracking'::
>>> +
>>> +Returns the tracking branch for the given remote (<name>) and branch
>>> +(<branch>). Note that <branch> must exactly match the left hand side of
>>> +the refspec of the given remote.
>>> +
>>
>> From that description, it is not clear to me if the branch is the _remote_
>> branch, the branch _on_ the remote, or the local branch.
> 
> OK. s/and branch/and remote branch/
> 
>> If it is the remote branch (or the branch on the remote), I wonder how you
>> deal with ambiguities, as I can easily create hundreds of branches
>> tracking the same remote branch.
> 
> AFAICS from remote_find_tracking (and some tests), it picks the first match.
> 
> So, additional text could be: In case of multiple matches, it picks
> the first one.
Why not have both:
  git remote tracking <remote> <remote branch>

would show all local branches that track <remote branch>, and have <remote> as default remote, while

  git remote tracking <local branch>

would show <remote> and <remote branch> if <local branch> is following remote-tracking branch.

-- 
Jakub Narebski
Poland
ShadeHawk on #git
Previous: Santi BéjarNext: Santi Béjar
Message 7 of 19 in “Support for arbitrary mapping for "git pull --rebase"”
  1. 0/2 Support for arbitrary mapping for "git pull --rebase"Santi Béjar, Jun 18, 2009
  2. 1/2 remote tracking: return the tracking branch for the given branchesSanti Béjar, Jun 18, 2009
  3. Paolo BonziniJun 18, 2009
  4. Santi BéjarJun 18, 2009
  5. Johannes SchindelinJun 18, 2009
  6. Santi BéjarJun 18, 2009
  7. Jakub NarebskiJun 18, 2009
  8. Santi BéjarJun 18, 2009
  9. Jakub NarebskiJun 18, 2009
  10. Santi BéjarJun 18, 2009
  11. Santi BéjarJun 18, 2009
  12. Junio C HamanoJun 18, 2009
  13. Santi BéjarJun 18, 2009
  14. Santi BéjarJun 18, 2009
  15. 2/2 get_remote_merge_branch: Support for arbitrary mappingSanti Béjar, Jun 18, 2009
  16. Santi BéjarJun 18, 2009
  17. Johannes SchindelinJun 18, 2009
  18. Santi BéjarJun 18, 2009
  19. Santi BéjarJun 19, 2009

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.