Re: [PATCH 0/3] reflog: add --operations and --historical-branch
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Oct 16, 2026, 18:36 UTC
- Message-ID
- <CALnO6CDOh1NCp4Y9euLbhVFJJnOc1jSk7q0ekdUeGniG8LTCGQ@mail.gmail.com>
- In-Reply-To
- <pull.2448.git.git.1792070038.gitgitgadget@gmail.com>
[Apologies for replying in the wrong chain; it appears I haven't received 3/3 yet and it's easier for me to reply to a message I have than one I can only see in lore.]
On Thu, Oct 15, 2026 at 9:20 AM Harald Nordgren via GitGitGadget <gitgitgadget@gmail.com> wrote:
> reflog: add --historical-branch to name the branch of each entry
Show 9 quoted lines
> Teach "git reflog" and "git log -g" a "--historical-branch" option
> that decorates each entry with the branch it was made on, in place of
> the refs that point at the commit now. The name is colored like a
> branch decoration:
>
> $ git reflog --historical-branch
> 4e5f6a7 (topic) HEAD@{0}: commit: add tests
> 1a2b3c4 (topic) HEAD@{1}: checkout: moving from main to topic
> 8c9d0e1 (main) HEAD@{2}: commit: fix typoNotice how the "HEAD@" column is now not aligned? I find it really convient to have fixed-width data at the front of the line so that I can visually pick out pieces in columns.
So I'd suggest an alternat end-of-line format:
$ git reflog --historical-branch
4e5f6a7 HEAD@{0}: commit: add tests (topic)
1a2b3c4 HEAD@{1}: checkout: moving from main to topic (topic)
8c9d0e1 HEAD@{2}: commit: fix typo (main)That might make picking out the branch name a little harder, so I suppose you could try right before the messages?
$ git reflog --historical-branch
4e5f6a7 HEAD@{0}: (topic) commit: add tests
1a2b3c4 HEAD@{1}: (topic) checkout: moving from main to topic
8c9d0e1 HEAD@{2}: (main) commit: fix typoor (since the "operation" prefixes" are useful)
$ git reflog --historical-branch
4e5f6a7 HEAD@{0}: commit: (topic) add tests
1a2b3c4 HEAD@{1}: checkout: (topic) moving from main to topic
8c9d0e1 HEAD@{2}: commit: (main) fix typo? Obviously the misalignment in all the examples (except the EOL format) gets worse when you have some short and some long branch names.