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

Re: [PATCH v2 0/3] reflog: add --operations and --historical-branch

From
Harald Nordgren <haraldnordgren@gmail.com>
Date
Oct 24, 2026, 18:46 UTC
Message-ID
<CAHwyqnVJ618QXq99M=XNm19eEObQC-DTLcpeYOiizzSu_YNEpw@mail.gmail.com>
In-Reply-To
<xmqq5wyr128q.fsf@gitster.g>
On Sat, Oct 24, 2026 at 6:40 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 45 quoted lines
>
> Phillip Wood <phillip.wood123@gmail.com> writes:
>
> > I'm rather skeptical of this in its current form. Not all commands that
> > modify the working tree update the reflog and some commands such as "git
> > cherry-pick A B C" create multiple reflog entires that are
> > indistinguishable from multiple invocations of a single command.
>
> I like the direction to make the default 'git reflog' output on a
> single branch easier to understand without needing any extra
> filtering in this series.
>
> 'git rebase' doing its work on a detached HEAD was likely the
> first, and we may want to convert more multi-step commands to do
> so, including the multiple 'git cherry-pick' you mention.  'git am'
> way predates the rebase that works on a detached HEAD ('git am'
> introduced in Oct 2005 predates the concept of detached HEAD that
> was introduced in Git 1.5.0 released in Feb 2007), and it does its
> work without detaching HEAD.  Its users grew to expect it to work
> that way, but I am not sure how problematic a regression it would
> be if we taught it to work more like 'git rebase'.  For example,
> because I am used to 'git am' working on the current branch, I
> often do
>
>     $ git checkout --detach master
>     $ git am -s ...mailbox...
>     $ git checkout -b pw/topic-by-phillip
>
> to compensate for the lack of it, in order to keep the events
> recorded in the reflog of the pw/topic-by-phillip branch to "one
> iteration per entry".  This helps me compare iterations more easily,
> e.g.,
>
>     $ git checkout pw/topic-by-phillip
>     $ git diff @{1}
>     $ git range-diff @{1}...
>
> But the workflow to actively detach by the end user would work just
> fine if 'git am' learns to detach first when started on a concrete
> branch, to work more like 'git rebase'.
>
> By the way, I too was annoyed that 'git reflog' defaults to the log
> of HEAD a long time ago, but the irritation soon waned once I made
> it a habit to always provide @{now} or @{0} to the command, as that
> notation refers to the current branch.
Thanks Phillip, Ben and Junio for pointing this out!

I didn't realize that reflog could be changed to operate only on one branch. And it makes it a lot better! Seems like it should be the default, and I don't think a lot of people would complain, I'll certainly never run the old reflog again.

However, the format is quite heavy with the full name references, seems like they could be cleaned up:

``` 0b8dc70369 (HEAD -> fetch-shallow-narrow-refspec, origin/fetch-shallow-narrow-refspec) refs/heads/fetch-shallow-narrow-refspec@{0}: > e4882d2794 refs/heads/fetch-shallow-narrow-refspec@{1}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 7e34d8174dcda3> 4b0cb31dd7 refs/heads/fetch-shallow-narrow-refspec@{2}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 7e34d8174dcda3> 11d2326038 refs/heads/fetch-shallow-narrow-refspec@{3}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 4603c84d688c32> 83ce62663e refs/heads/fetch-shallow-narrow-refspec@{4}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 7e34d8174dcda3> d633b1fc1b refs/heads/fetch-shallow-narrow-refspec@{5}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 7e34d8174dcda3> 9ca7fe6077 refs/heads/fetch-shallow-narrow-refspec@{6}: pull (finish): refs/heads/fetch-shallow-narrow-refspec onto 7e34d8174dcda343> 552bf08971 (tag: pr-git-2412/HaraldNordgren/fetch-shallow-narrow-refspec-v10) refs/heads/fetch-shallow-narrow-refspec@{7}: rebase (f> 9ee090d3d0 (tag: pr-git-2412/HaraldNordgren/fetch-shallow-narrow-refspec-v9) refs/heads/fetch-shallow-narrow-refspec@{8}: rebase (fi> db27c29086 (tag: pr-git-2412/HaraldNordgren/fetch-shallow-narrow-refspec-v8) refs/heads/fetch-shallow-narrow-refspec@{9}: rebase (fi> 10c6be7ce9 refs/heads/fetch-shallow-narrow-refspec@{10}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 6de20f6092dcf> acb47efdc1 refs/heads/fetch-shallow-narrow-refspec@{11}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto b5db64d56fa32> 9fe17a1968 refs/heads/fetch-shallow-narrow-refspec@{12}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto b5db64d56fa32> 591e69aa88 refs/heads/fetch-shallow-narrow-refspec@{13}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto b5db64d56fa32> 16c467682b refs/heads/fetch-shallow-narrow-refspec@{14}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto b5db64d56fa32> d5107dcb5d refs/heads/fetch-shallow-narrow-refspec@{15}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 6de20f6092dcf> c8fd073de3 (tag: pr-git-2412/HaraldNordgren/fetch-shallow-narrow-refspec-v7) refs/heads/fetch-shallow-narrow-refspec@{16}: rebase (f> 632ad9e6eb refs/heads/fetch-shallow-narrow-refspec@{17}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 6de20f6092dcf> cbeb1bf547 refs/heads/fetch-shallow-narrow-refspec@{18}: pull (finish): refs/heads/fetch-shallow-narrow-refspec onto 6de20f6092dcf9b> 005e30ee30 refs/heads/fetch-shallow-narrow-refspec@{19}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 8103b446517e0> 2609473369 refs/heads/fetch-shallow-narrow-refspec@{20}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 8103b446517e0> d986bb7abe refs/heads/fetch-shallow-narrow-refspec@{21}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 7303c95b3b667> 01d4bba698 refs/heads/fetch-shallow-narrow-refspec@{22}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 8103b446517e0> 844ca50185 refs/heads/fetch-shallow-narrow-refspec@{23}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 2e37944e2883f> 864fc79e86 refs/heads/fetch-shallow-narrow-refspec@{24}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 2e37944e2883f> 8212be8acc refs/heads/fetch-shallow-narrow-refspec@{25}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 8103b446517e0> de83f683aa refs/heads/fetch-shallow-narrow-refspec@{26}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 8103b446517e0> bc9f5f0a75 refs/heads/fetch-shallow-narrow-refspec@{27}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto f9856e2cf3f65> 29869baf42 refs/heads/fetch-shallow-narrow-refspec@{28}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 8103b446517e0> bb9c735cc5 refs/heads/fetch-shallow-narrow-refspec@{29}: pull (finish): refs/heads/fetch-shallow-narrow-refspec onto 8103b446517e0c4> 84d192445c (tag: pr-git-2412/HaraldNordgren/fetch-shallow-narrow-refspec-v6) refs/heads/fetch-shallow-narrow-refspec@{30}: rebase (f> 5dd7145ab7 refs/heads/fetch-shallow-narrow-refspec@{31}: pull (finish): refs/heads/fetch-shallow-narrow-refspec onto c46c1e37724f047> 8c2a144eb7 (tag: pr-git-2412/HaraldNordgren/fetch-shallow-narrow-refspec-v5) refs/heads/fetch-shallow-narrow-refspec@{32}: rebase (f> 43b9711a2c (tag: pr-git-2412/HaraldNordgren/fetch-shallow-narrow-refspec-v4) refs/heads/fetch-shallow-narrow-refspec@{33}: pull (fin> 73fec138c3 refs/heads/fetch-shallow-narrow-refspec@{34}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto d3ee079ea9d66> 49f194522a refs/heads/fetch-shallow-narrow-refspec@{35}: commit (amend): remote: default to --limited-fetch in a shallow repository 84f6640ab9 refs/heads/fetch-shallow-narrow-refspec@{36}: rebase (finish): refs/heads/fetch-shallow-narrow-refspec onto 0f8e75abebff0> ```

Harald
Previous: Junio C HamanoNext: Kristoffer Haugsbakk
Message 30 of 51 in “reflog: add --operations and --historical-branch”
  1. 0/3 reflog: add --operations and --historical-branchHarald Nordgren via GitGitGadget, Oct 15, 2026
  2. 1/3 reflog: name the strings that mark switches, renames and rebase stepsHarald Nordgren via GitGitGadget, Oct 15, 2026
  3. Kristoffer HaugsbakkOct 15, 2026
  4. Harald NordgrenOct 15, 2026
  5. 2/3 reflog: add --operations to show one entry per commandHarald Nordgren via GitGitGadget, Oct 15, 2026
  6. 3/3 reflog: add --historical-branch to name the branch of each entryHarald Nordgren via GitGitGadget, Oct 15, 2026
  7. Kristoffer HaugsbakkOct 15, 2026
  8. Harald NordgrenOct 15, 2026
  9. Kristoffer HaugsbakkOct 15, 2026
  10. Harald NordgrenOct 15, 2026
  11. D. Ben KnobleOct 16, 2026
  12. Harald NordgrenOct 23, 2026
  13. D. Ben KnobleOct 16, 2026
  14. Harald NordgrenOct 17, 2026
  15. 0/3 reflog: add --operations and --historical-branchHarald Nordgren via GitGitGadget, Oct 18, 2026
  16. 1/3 reflog: name the strings that mark switches, renames and rebase stepsHarald Nordgren via GitGitGadget, Oct 18, 2026
  17. Junio C HamanoOct 23, 2026
  18. Harald NordgrenOct 23, 2026
  19. Junio C HamanoOct 23, 2026
  20. 2/3 reflog: add --operations to show one entry per commandHarald Nordgren via GitGitGadget, Oct 18, 2026
  21. 3/3 reflog: add --historical-branch to name the branch of each entryHarald Nordgren via GitGitGadget, Oct 18, 2026
  22. Kristoffer HaugsbakkOct 25, 2026
  23. Harald NordgrenOct 25, 2026
  24. Kristoffer HaugsbakkOct 26, 2026
  25. Harald NordgrenOct 26, 2026
  26. Harald NordgrenOct 23, 2026
  27. Phillip WoodOct 24, 2026
  28. D. Ben KnobleOct 24, 2026
  29. Junio C HamanoOct 24, 2026
  30. Harald NordgrenOct 24, 2026
  31. Kristoffer HaugsbakkOct 25, 2026
  32. Phillip WoodOct 26, 2026
  33. Harald NordgrenOct 26, 2026
  34. Junio C HamanoOct 26, 2026
  35. Ben KnobleOct 27, 2026
  36. Junio C HamanoOct 27, 2026
  37. Harald NordgrenOct 27, 2026
  38. Ben KnobleOct 27, 2026
  39. Harald NordgrenOct 24, 2026
  40. 0/2 reflog: add --operations and --historical-branchHarald Nordgren via GitGitGadget, Oct 27, 2026
  41. 1/2 reflog: name the strings that mark switches, renames and rebase stepsHarald Nordgren via GitGitGadget, Oct 27, 2026
  42. 2/2 pretty: add %gb to name the branch of each reflog entryHarald Nordgren via GitGitGadget, Oct 27, 2026
  43. Phillip WoodNov 3, 2026
  44. 0/2 reflog: add format %gbHarald Nordgren via GitGitGadget, Nov 4, 2026
  45. 1/2 reflog: name the strings that mark switches, renames and rebase stepsHarald Nordgren via GitGitGadget, Nov 4, 2026
  46. 2/2 pretty: add %gb to name the branch of each reflog entryHarald Nordgren via GitGitGadget, Nov 4, 2026
  47. Phillip WoodNov 6, 2026
  48. Harald NordgrenNov 7, 2026
  49. 0/2 reflog: add format %gbHarald Nordgren via GitGitGadget, Nov 7, 2026
  50. 1/2 reflog: name the strings that mark switches, renames and rebase stepsHarald Nordgren via GitGitGadget, Nov 7, 2026
  51. 2/2 pretty: add %gb to name the branch of each reflog entryHarald Nordgren via GitGitGadget, Nov 7, 2026

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.