From: Harald Nordgren Date: Sat, 24 Oct 2026 18:46:28 GMT Subject: Re: [PATCH v2 0/3] reflog: add --operations and --historical-branch Message-ID: In-Reply-To: On Sat, Oct 24, 2026 at 6:40 PM Junio C Hamano wrote: > > Phillip Wood 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