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, 14:46 UTC
Message-ID
<adf1fd3d0901300646h39e27f50pdb6510083284cf8a@mail.gmail.com>
In-Reply-To
<a2633edd0901300606ub4c507bocccb6747b436f01f@mail.gmail.com>
2009/1/30 Pascal Obry <pascal@obry.net>:
Show 8 quoted lines
>> 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"
>
> The second point wasn't clear to me.
A practical example:

$ git clone path/to/project.git $ cd project $ git checkout -b bugfix-1234 origin/master $ # hack, hack, hack $ git commit -a -m "Fix for the Bug #1234" $ git push origin HEAD:master

So, you've done a commit in a local branch named bugfix-1234 and once you push it to the master branch in origin there is nothing to tell you so. A commit is defined with the current state, the old commit(s) and some metadata (author and committer) but nothing about which branch it was made, and as a branch is a pointer to a commit there is nothing more.

Santi
Previous: Pascal ObryNext: Michael J Gruber
Message 8 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.