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

Re: Finding the name of the parent branch?

From
SBSanti Béjar <santi@agolina.net>
Date
Jan 30, 2009, 13:57 UTC
Message-ID
<adf1fd3d0901300557t19ca4bccn7fe24013a05d2d57@mail.gmail.com>
In-Reply-To
<a2633edd0901300535mf2d9ceemd9e9009e0aa18b40@mail.gmail.com>
2009/1/30 Pascal Obry <pascal@obry.net>:
Show 8 quoted lines
> Santi,
>
>> Maybe if you explain why you want it (a use case) instead of just this
>> specific problem...
>
> To know the proper merge base to display all commits done on a specific
> topic branch.
>
gitk topicbranch ^trackingbranch
But I agree that a way to refer to the tracking branch would be great, as:
branch^{origin}
so you can say, for example:
gitk topicbranch ^topicbranch^{origin}
Show 22 quoted lines
>>>> Just a counterexample, just rearranging you graph:
>>>>
>>>>                        o---B
>>>>                        /
>>>>                   o---2---o---o---o---C
>>>>                  /
>>>>          ---o---1---o---o---o---A
>>>>
>>>> From you description: For B I would get C and for C I would get A.
>>
>> Please, if you quote text do not edit it (the 1 and the 2 in this case).
>
> Well I've just added 1 and 2, nothing changed in the semantic!
>
>> Yes. Compare your sentence and mine:
>>
>> For B I want to get A and for C I want to get B.
>> For B I would get C and for C I would get A.
>>
>> So for B you get A while I get C, and the equivalent for C.
>
> Ok, that's expected since you have renamed B to C and C to B.
I did not rename B to C and C to B, I just draw them differently.
Let's put name to the commits:
Your tree:
                        i---j---k---C
                        /
                   f---g---h---B
                  /
          ---a---b---c---d---e---A
My tree:
                       h---B
                       /
                  f---g---i---j---k---C
                 /
         ---a---b---c---d---e---A

So the commits in all the branches are equal, the only change is that I painted B above C.

Show 10 quoted lines
> So when I said:
>
>    For B I want to get A and for C I want to get B.
>
> It is equivalent to your (just rename B and C).:
>
>   For B I would get C and for C I would get A.
>
> Frankly I do not see your point... That's maybe the cause of the
> problem I'm having....
At least part of. You have to understand the branch model:
git model:
  * a branch is just a pointer to a commit
  * you cannot say "this commit was done in that branch"
  * what you can say is "this commit is contained in that branch"
in contrast to other models:
  * where a commit really belongs to a branch (it is specified at
commit time somehow)
  * you can say "this commit was done in that branch"

HTH, Santi

Previous: Pascal ObryNext: Pascal Obry
Message 6 of 11 in “Finding the name of the parent branch?”
  1. Pascal ObryJan 30, 2009
  2. Santi BéjarJan 30, 2009
  3. Pascal ObryJan 30, 2009
  4. Santi BéjarJan 30, 2009
  5. Pascal ObryJan 30, 2009
  6. Santi BéjarJan 30, 2009
  7. Pascal ObryJan 30, 2009
  8. Santi BéjarJan 30, 2009
  9. Michael J GruberJan 30, 2009
  10. Thomas KochJan 30, 2009
  11. Pascal ObryJan 30, 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.