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

Re: [problem with name-rev] (was: git log --graph with a sort of local revision number)

From
Rafael Ascensão <rafa.almas@gmail.com>
Date
Aug 20, 2019, 17:49 UTC
Message-ID
<20190820174929.GA6753@rigel>
In-Reply-To
<87pnkzkivn.fsf_-_@mat.ucm.es>
On Tue, Aug 20, 2019 at 04:32:12PM +0200, Uwe Brauer wrote:
> 
> It seems that there is problem with name-rev.
> 

In git, branches are just pointers to a commits. Commits do not store any information about branches. They're similar to mercurial bookmarks.

Thus, git is not able to answer "Was commit X was made in branch Y?".

What that command does is describe each entry in the log in function of your active branch. Keep in mind that these descriptions are relative, and they'll change as you make more commits.

It is basically asking git the following:
    "Is commit X (each log entry) an ancestor of the commit pointed by
    branch Y? (HEAD, meaning your active branch) If yes, describe the
    relationship between them"
Considering your example,
*   changeset: ae68dbe:master
    |\  user:      Uwe Brauer
    | | date:      Tue Aug 20 16:25:53 2019 +0200
    | | summary:   1.2.1/1.1
    | |
    | * changeset: c00bb5d:master^2
    | | user:      Uwe Brauer
    | | date:      Tue Aug 20 16:25:53 2019 +0200
    | | summary:   1.2.1
    | |
    | * changeset: 54c9230:master^2~1
    | |
54c9230 is the parent (~1) of master's second parent (master^2).

If you make an additional commit on master, the same 54c9230 will be described as master~1^2~1

Check the documentation to learn the syntax: git help revisions
If want a permanent reference for a commit, you'll need to:
    1) Use an unambiguous prefix of the commit ID.
    2) Make a tag to the commit you want to reference.

Cheers, Rafael Ascensão

Previous: SZEDER GáborNext: Junio C Hamano
Message 8 of 13 in “git log --graph with a sort of local revision number”
  1. Uwe BrauerAug 15, 2019
  2. Rafael AscensãoAug 18, 2019
  3. Uwe BrauerAug 18, 2019
  4. Uwe BrauerAug 18, 2019
  5. [SOLVED] (was: git log --graph with a sort of local revision number)Uwe Brauer, Aug 18, 2019
  6. [problem with name-rev] (was: git log --graph with a sort of local revision number)Uwe Brauer, Aug 20, 2019
  7. SZEDER GáborAug 20, 2019
  8. Rafael AscensãoAug 20, 2019
  9. Junio C HamanoAug 20, 2019
  10. Uwe BrauerAug 20, 2019
  11. Phil HordAug 20, 2019
  12. Uwe BrauerAug 21, 2019
  13. Uwe BrauerAug 21, 2019

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.