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
D. Ben Knoble <ben.knoble@gmail.com>
Date
Oct 24, 2026, 15:22 UTC
Message-ID
<CALnO6CCtm2PLOfnNF8p2aGU5Pn71qimdC4aAS130O5PrzQb_oQ@mail.gmail.com>
In-Reply-To
<bfc2b43a-6198-47b0-8868-d92551548f22@gmail.com>
On Sat, Oct 24, 2026 at 9:51 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 19 quoted lines
>
> Hi Harald
>
> On 18/10/2026 19:27, Harald Nordgren via GitGitGadget wrote:
> > Create a better reflog. Follows the discussion in
> > https://lore.kernel.org/git/akZfm-igZKeHaDST@pks.im/.
> >
> > "git reflog" lists every step of a rebase and every branch switch, which
> > makes it hard to see what was done and on which branch. This adds two
> > options to "git reflog" and "git log -g":
> >
> >   * --operations shows one entry per command, folding a rebase into the entry
> >     that finished or aborted it, and leaves out entries that change no
> >     branch.
>
> 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.

Great point. I thought it was very neat that we could make progress towards this simply by parsing out existing reflogs, but it's always going to be a bit heuristic.

> The
> message you cite above is arguing that we need a separate operations log
> if we want to overcome these problems.

I also thought this series would be doing something like a true ops log, which would be very cool.

Show 6 quoted lines
> Most of what this option does can
> be achieved by looking at the branch reflog instead (I really wish that
> "git reflog" defaulted to the current branch rather than HEAD). I'm not
> opposed to supporting some kind of filtering/simplification particularly
> for HEAD, but we should not pretend we're showing users one entry per
> command.
Ditto
Show 9 quoted lines
> >   * --historical-branch decorates each entry with the branch HEAD was on when
> >     it was recorded.
>
> I quite like this idea, but think it would be nicer implemented as a
> format specifier ("%gb" seems to be free) so that users can use it in
> their custom formats. I'd be quite happy to change the default format do
> for HEAD to include the branch name after the reflog message but I'm not
> sure others would be so keen (perhaps we could get away with guarding
> any change by isatty()/GIT_PAGER_IN_USE?).

I'm quite a bit more positive on this change, but I like the composability of a format-specifier. Great idea.

Show 11 quoted lines
> If we're going to do this we should make sure it supports "git rebase
> <upstream> <branch>" so that the branch names are accurate. That is a
> bit involved because you have to compare the name of the branch being
> rebased (which is in the "(finish)" reflog message) to the name of the
> branch that was checked out before (which isn't in that message so you
> have to go looking for a previous rebase or checkout). It also needs to
> take account of rebases that checkout a detached HEAD which don't have
> the "(finish)" message and those that checkout an up-to-date branch or
> detached HEAD where the message is "$GIT_REFLOG_ACTION: checkout
> $revision". I've got a patch [1] that fixes this for "@{-N}" which I
> think works, but it needs some more tests.

Ouch. This definitely points to my "heuristic" above, and while we could maybe invest time in the reflog + parsing to make this work, it seems somehow simpler to have an event or ops log with more structure for this new purpose.

-- D. Ben Knoble

Previous: Phillip WoodNext: Junio C Hamano
Message 28 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.