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

Re: How can I search git log with ceratin keyword but without the other keyword?

From
Carlo Arenas <carenas@gmail.com>
Date
Jul 19, 2020, 08:26 UTC
Message-ID
<CAPUEspj3A-bCo+WqiGksuLkqm65HAPiOjrWaAyy7S8XSy_Ohiw@mail.gmail.com>
In-Reply-To
<CAAvDm6aNN2kDh=SF6_K-v+cq0a94tcQ1AQ-Fpgs2mNo18FTFfQ@mail.gmail.com>
On Sat, Jul 18, 2020 at 10:28 PM 孙世龙 sunshilong <sunshilong369@gmail.com> wrote:
> Is there some method(or command provided by git) that could get the
> comments of a certain commit (e.g: first, second,... nth)

what you are looking for is described sometimes as "relative reference" [1], so for example if you want to refer to the commit before last (ex: second from the top, counting as 0 base) in a repository that looks like:

$ git log --oneline b1824b2 (HEAD -> master) second 00d85f1 first 68757c9 initial

$ git log --oneline -n 1 HEAD@{1} 00d85f1 first

Carlo
[1] https://git-scm.com/book/zh/v2/Git-%E5%B7%A5%E5%85%B7-%E9%80%89%E6%8B%A9%E4%BF%AE%E8%AE%A2%E7%89%88%E6%9C%AC
Previous: 孙世龙 sunshilongNext: Junio C Hamano
Message 12 of 16 in “How can I search git log with ceratin keyword but without the other keyword?”
  1. 孙世龙 sunshilongJul 10, 2020
  2. Carlo ArenasJul 10, 2020
  3. 孙世龙 sunshilongJul 11, 2020
  4. Jeff KingJul 16, 2020
  5. 孙世龙 sunshilongJul 17, 2020
  6. Jeff KingJul 17, 2020
  7. Junio C HamanoJul 17, 2020
  8. Junio C HamanoJul 17, 2020
  9. 孙世龙 sunshilongJul 18, 2020
  10. Junio C HamanoJul 18, 2020
  11. 孙世龙 sunshilongJul 19, 2020
  12. Carlo ArenasJul 19, 2020
  13. Junio C HamanoJul 20, 2020
  14. Carlo ArenasJul 22, 2020
  15. 孙世龙 sunshilongJul 17, 2020
  16. 孙世龙 sunshilongJul 17, 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.