From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793722618; b=Q580Z9qWQPA5V+C5Mcfay5H5yyBDTI2s5yjLrxLGQsKZHC5VUUiYcE3wJwN8gWnYPNIP lpR7Og13GMw1vKbpAho35sOd8GhPToepPYNHObm7HXVrbUDpAg83eoMg/y96nnOT6pnVx hcgSA5XM3pO9hYTqJ1RU3UAwe3qGiEqln4HT/BBF4VY4HcnIrzg8rOJ4MkcC+inR+8pa3 65dwqYUOQaBoaxnoM2RhfsnBcKFcWFPKwqpwWXXRjjhOSABL6GihASdE+dHfyB2LNtj04 KoFV2h1I9MDgKRe1Akw3zEDkQoheU/kZhkT4HE1QoOrar5a7jZEjHs6WVSlyCWfOOFQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793722618; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Message-ID:Date:MIME-Version:User-Agent:From:Reply-To:Subject:To:Cc: References:Content-Language:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=DOw1juXiJEpApzGybbaMB5w+BIoGb8CZFROKEtFsTbQ=; b=G7D/RvDk3cY5frs2jxtug+AuRVGSVs5pYjbPuRk4al0qvlZXCEH1o9RnWGZs+b9+IY97 bz3uYCs3IM1T8TmJCJ2PnZICF6W25NtkcUuSfzpKvbOG5E6tHHRx/3HvJuM0+lkf5rRMB Cg+oSA6CfroERNdoKwrZYlLxOzqukPCGLUoPHYHaphNAMb3b6IPCdasQ7cBHb9aWMsHnB 1bbh7MMPcnap+SMEmz4jmGKXvGcDoIhICEv4zJESPftsBrYxJ5vXrHmUd1eprd/cQfcuY jZynfIXi4qCmVkFirU/3/yG2Tkbpb9Cu9i8ZTlzDDIY+kAjCBayNrEqRKB8/JjxLpRQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ToHoWJEy; arc=none smtp.remote-ip=209.85.128.48 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 493B7606A329 for ; Tue, 3 Nov 2026 16:16:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 493B7606A329 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=ToHoWJEy Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4a35db1f202so45751815e9.3 for ; Tue, 03 Nov 2026 08:16:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1793722617; x=1794327417; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:subject:reply-to:from:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to:content-type; bh=DOw1juXiJEpApzGybbaMB5w+BIoGb8CZFROKEtFsTbQ=; b=ToHoWJEyVWIiu3CR4/7sA7eGO8OIWrd3eUEtQii31YSsrKE/cXZIaygooGwFw/sB0X /it1dy9rA+w95nCtAQNtQJ8kDovelKswNiBL9MjapAPAf2cFskUpWJF2IzDJX5pX5D1+ FHKgV36rB75i+R+T3E5xinmeynnCYQxDSGagT8fFAhj6RI8HqYgWours45BfU+6lAPat bu9PnWl01KlAZVF/Cp785F8UAPVSRiPWPvPG68dOiszHYiiba8PrHEfcaaFVZAQzhU47 OwgRe6MH3QT7BwUPlpMnMevEdeTO0KupI7xNdYqZp2152Vq0aWPngA1woVrUphcyxa/u KtaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793722617; x=1794327417; h=content-transfer-encoding:content-type:in-reply-to:content-language :references:cc:to:subject:reply-to:from:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=DOw1juXiJEpApzGybbaMB5w+BIoGb8CZFROKEtFsTbQ=; b=xSMxPFsygZzb0Ec5ptc8u6uZGNrEuD1bxCRUALCq4gaEQcEaM7sugfVbXNPLFD+BUe gfv7Mvz8cNS9GnlXPzr8xkC9aRLzYNa/Q6dthM4n7XDpIAio2unou0BbVScfh94/EPyY GQzU8hZ9501RPG7wD8BKgB2qnP3lGzPAdeWrmow4LsZ81LSMUNq8Z1ptlysyv8F8/wPi UpLNIMm/3WRsXD92rAg+aPFG66399xGzPLX6/14PB082Do2itq0MR6Mf9b45gmRbQd3W ELglXv8eERVZgebz0tqk0G/YaYwnUuzIj4CKPtwc+0YWv59ZXsIjXdMYdhn+y2Scl2e3 RXLg== X-Forwarded-Encrypted: i=1; AKwUvBwR8GQP1vD0OelJR6Ul985AThg5HsYzZH0ttGEX/4kLAmS/jIqCnSrNtpxuHVYKVcrV5Is=@vger.kernel.org X-Gm-Message-State: APuU4Z/VhtxDJ4LkdnSgiN0oFW0YNw0NIiLQoPABg9NHQe+iuJo2WjQV /xSa/+T83WbDIReVKdsHMEwSjCrW726+dGkzeUy0G/NIympTKUOmpMQ3 X-Gm-Gg: AYBFou1oS3Sizf3DbG11aIHMNXIGxALauoOjxDmGCrJv5Fnr5uHLEAdnWy2ko9ju6VC 5QgryZAyj2Qyl1P2gZ3Rje7/xmiMnsdKkP8hNiTb+N41Ovz1HPG/+Q7kqaKcE/SkhN6g/70JCmF KIZNp6CGxr+m4b/HzL2g8imMv0EUm8q8OJ5PgCihSAu/kfslsxPU5rH+1P/Uh4JFwUrR1VPoigh CT2dk2Dp3Uvy6z3F7mShzHA3VXCIBQGM85FCRxqvUrlGwUNM1Tr4JE6T5vLffG8gYQ5kaG1bzAt F8HkQaFipaUeNm8smphokYMP/R30nFRk0scJqRZiqAVNv/IrhpC8EV/+fUO+8r5/iFg8Uhji8qK ceWhnt1OtTtzxo5JKUO2ZT14j5cyqmuYQN3oGesxGMknej4LMvcfFuW2vYp/z3dkHKWkwvU9b6A tQTz7ikrWvrsqZfRJBQq2j3esZSxWoJ810boUyUN9ZW2lREXs71oOXuQ2zBEa0kiZL7t93oTPue AFZF1Uwb01REsSIjS/cYjE2D6fR/s+H2zc92VIqV1p2odJnannEz4vE9AHJlq553dA7ulUAnUuw GXsR/Oi08+4nlJRzwD5zcws4Flg/6TS5+BjOk02Nx4MFMT3HUQsc5uSNghg9SSx+GGLsYaSm7Vl Q1KtxKWw7QNplzQID0z9YXgHAO1U= X-Received: by 2002:a05:600c:64c5:b0:4a2:150f:1613 with SMTP id 5b1f17b1804b1-4ac17a367edmr318289675e9.7.1793722616464; Tue, 03 Nov 2026 08:16:56 -0800 (PST) Received: from ?IPV6:2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f? ([2a0a:ef40:724:6601:f3ff:aebc:61f8:d91f]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e86a06078sm10039111f8f.54.2026.11.03.08.16.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 03 Nov 2026 08:16:55 -0800 (PST) Message-ID: <49144eb0-9755-4843-930e-ae7b3b519080@gmail.com> Date: Tue, 3 Nov 2026 16:16:54 +0000 X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Phillip Wood Reply-To: phillip.wood@dunelm.org.uk Subject: Re: [PATCH v3 2/2] pretty: add %gb to name the branch of each reflog entry To: Harald Nordgren via GitGitGadget , git@vger.kernel.org Cc: Kristoffer Haugsbakk , "D. Ben Knoble" , Harald Nordgren References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Hi Harald On 27/10/2026 08:38, Harald Nordgren via GitGitGadget wrote: > From: Harald Nordgren > > Add a "%gb" placeholder that names the branch HEAD was on when each > entry was recorded: > > $ git log -g --format='%h %gd: (%gb) %gs' > 9c8d7e6 HEAD@{0}: (topic) rebase (finish): returning to refs/heads/topic > 9c8d7e6 HEAD@{1}: (topic) rebase (pick): add tests > 1a2b3c4 HEAD@{2}: (topic) rebase (start): checkout main > 1a2b3c4 HEAD@{3}: (main) commit: fix typo > 5d6e7f8 HEAD@{4}: (main) checkout: moving from topic to main Looks good > The branch is read from the entries that branch switches, branch > renames and rebases leave behind. "the entries created by ..."? > The entries of a rebase are named > after the branch being rebased. This sounds very LLM, "labelled with the branch being rebased"? > When HEAD was detached, the entry > shows "detached at " with the commit HEAD was at when it > moved on. I wondered if that was a bit verbose, but having tried it, it is no longer than some of my branch names. > When nothing older in the reflog says which branch a rebase > started on, the rebase is taken to have started on the branch it > rebased. For the reflog of any other ref, "%gb" is the name of that > ref. I'm seeing some strange behavior when GIT_REFLOG_ACTION is set, below is the output of "git reflog --format='%h %gd %gs (%gb)'" for my local HEAD. I've added comments above the lines where the branch name is incorrect. The "sync switch" entries come from running "git rebase" with GIT_REFLOG_ACTION set. be8e0d55ec HEAD@{0} reset: moving to HEAD (sequencer-delete-REBASE_HEAD) be8e0d55ec HEAD@{1} sync switch: checkout sequencer-delete-REBASE_HEAD (sequencer-delete-REBASE_HEAD) # should be fix-nth-prior-checkout 64822b4a3b HEAD@{2} sync switch: checkout fix-nth-prior-checkout (sequencer-delete-REBASE_HEAD) # should be detached at 64882b4a3b 64822b4a3b HEAD@{3} rebase: fast-forward (sequencer-delete-REBASE_HEAD) # should be detached at 64822b4a3b bf19b60d89 HEAD@{4} rebase (start): checkout @^ (sequencer-delete-REBASE_HEAD) 64822b4a3b HEAD@{5} rebase: fast-forward (detached at 64822b4a3b) bf19b60d89 HEAD@{6} rebase (start): checkout fix-nth-prior-checkout^ (detached at 64822b4a3b) be8e0d55ec HEAD@{7} rebase: checkout sequencer-delete-REBASE_HEAD (sequencer-delete-REBASE_HEAD) be8e0d55ec HEAD@{8} rebase (start): checkout sequencer-delete-REBASE_HEAD (detached at be8e0d55ec) 64822b4a3b HEAD@{9} checkout: moving from 64822b4a3ba71e5a823002cd5ebe0fa5fb4b3a0c to fix-nth-prior-checkout (fix-nth-prior-checkout) Thanks Phillip > Signed-off-by: Harald Nordgren > --- > Documentation/pretty-formats.adoc | 3 + > pretty.c | 4 + > reflog-walk.c | 156 ++++++++++++++++++++++++++++-- > reflog-walk.h | 2 + > t/t1414-reflog-walk.sh | 122 +++++++++++++++++++++++ > 5 files changed, 281 insertions(+), 6 deletions(-) > > diff --git a/Documentation/pretty-formats.adoc b/Documentation/pretty-formats.adoc > index 2ae0eb11a9..a8d00397c4 100644 > --- a/Documentation/pretty-formats.adoc > +++ b/Documentation/pretty-formats.adoc > @@ -334,6 +334,9 @@ endif::git-rev-list[] > +%gE+:: reflog identity email (respecting .mailmap, see > linkgit:git-shortlog[1] or linkgit:git-blame[1]) > +%gs+:: reflog subject > ++%gb+:: reflog branch, the branch `HEAD` was on when the entry was > + recorded, e.g., `topic` or `detached at 1a2b3c4`. For the reflog > + of any other ref, this is the shortened refname. > ++%(trailers++`[: