From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793090337; b=Z7CHgbqrXEQ2GMz/m58BxQh9e9R91o6Ow5NQfgeCb5L0hqZRZSQvt5jDlEUpMpxqY9LH zvly/CtrgaD9Nnrj/Wv7nVV02WRYC2Ohbtb+nYb4DjYBXW+Q77EAmbnWpDP1Ww8qASmJh 2Li0EDQC7Iz67HVx9XZkIsPRlwwe+oyBdlsIptgrUeNKmPPESDsrOkMaP01b6HgHrO6is Lrj391+HKUXpFROzFgzbanQrDZ9OziLDxs4EB2RTqWQsiC8kNJn5NOimr6ViENoA5YthM 8Jm5kH9C+sREdD6mYiGJK3iGTGqlaeBgGxIr86XLfzQRsCOV1Vd0wWkfx3edye+N1Fw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793090337; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:In-Reply-To: References:From:Date:Subject:Fcc:Content-Type: Content-Transfer-Encoding:MIME-Version:To:Cc; bh=+W4QgKIBlf66KulOg3kFNehceS/JT++0Uc+heDJEKhA=; b=1mm2CYBmwPGq9FXaW8tFwwIwz03XV+DA01zNmNExD3F23F+aBsT2ZzYJ2KlVyXU0vToF 6qI4rKn5NgFFJ7tkv/CiF70NHQX4bDmpB/231NTzzLmJg18h7rKX2NL2MzoO8yUGZfhIe VlvwnQyA0qiGAdeRzH/Lgz4yrp0oxasCktK7Kg3GJoLAg+RrN79HzRf6yiSUs1F/6y88n WlTYabjAhzLO8WRDpPADpVeYjBeJGgLLVvaWsl5nDRf0pSusAbrduDcJrbG1F6YQTdNvO VDwL2Gnj8nic8C29WOyytYYIiLNANFkDIkRVONejXrhrC4RAsbmVX9AgkizwYXL+mQQ== 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=20251104 header.b=U0NLsDNp; arc=none smtp.remote-ip=209.85.161.44 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (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 04CE1606A326 for ; Tue, 27 Oct 2026 08:38:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 04CE1606A326 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=20251104 header.b=U0NLsDNp Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-6cfed5dd083so2388752eaf.1 for ; Tue, 27 Oct 2026 01:38:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1793090336; x=1793695136; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:references:in-reply-to:message-id:from:to:cc :subject:date:message-id:reply-to:content-type; bh=+W4QgKIBlf66KulOg3kFNehceS/JT++0Uc+heDJEKhA=; b=U0NLsDNp3AVwkPuzKKL0PWaczNmQmDLZzx/EaEMCiS/As29oIxKI/0l5Rlx3fTsle2 YdFGddMJpJWwd3l9kB1KtkTof2L48/J8QnTHnMbOG3bgUhTN8OHJLSsTO30hmMC4AOwK +2FaAEMqgwVuhoiG9hFkdPYnJHWXtVY8rVrCMrsUiBnFg0UVCd7DOduvmPoUTfSLO83N nS+U4vk6FTqceeuVrSj0VRJka0c04Ha1kPJAm74nO+4KMChLV1k+kHKqaIVZ9wiFumR+ LAzxQqj/+HHkitfztZkBCCq8dUWZzyq7QJRUd6KjE/hbNFq8Ovf1r3V6qbc3oaSaHoiQ uv0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793090336; x=1793695136; h=cc:to:mime-version:content-transfer-encoding:content-type:fcc :subject:date:from:references:in-reply-to:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=+W4QgKIBlf66KulOg3kFNehceS/JT++0Uc+heDJEKhA=; b=ZebjjH5XdpU4GYcZJ5nTIuFnVosgrtdwln7GDIeQESWpn0FP/cHkwvpuMKg5WAlGVh wRS4tKrIgsBRqPIAqX4AiOIM3uscbbOThDUtKrHgI4wEaNObTHgFVlyr1MeYlHEOzEcO 53lKXciJxDsB5vUbXLCbRmw2WfksLpDX+EAHGM+u5EKnrkt14GxnIaOtfhKnhelqU8fR oe/1QSVz+fykwyNFr7SoNkwUihO48AroWWu7ysXyloEbjNHocttZdi7qA7A1QAgzkep3 T6FxbEkP6nnsO2ZOE1stj9qI2kpnD4R/jsCUMc93IRv3saFvPpubaPvpYfXt4Z0eOuLE SY1w== X-Gm-Message-State: AFq9FYK4/3cAqoTV7ekkXRZzdHvRJ/GHBAYW06yPEI/AKWADORCW2Ax2 4VC/lBq4Q6c4beU0b+IKWxtoAnFRYjQddtmuHpSEmMVSiD56AdsxiKwOUT/+APVvkBs= X-Gm-Gg: AYBFou1UR6B0U4rdJQny3OxNd+zu8dSan4hFH0scQogIzEZnxaqt7zezJDUgWPNU5z+ 1klsvWftL0UhzgBhEpaeZjh/bHUk07RbiK8JvxRwSWEdvGQETF0+hfGmj/luwhtyVxX/8PjQHng X8Yt/9LsCTtFWSuRYHaH5Yuor0XTS3fak2PByGUwG0LgKlCxrvy39iZUBQDEp3Jco0Hi5xOkEtV HCuJ7Fl+d/cytf4Jvh06EcdlSg2j5KfEDnPxE2rMRqOTMf3iiMAFAVVapWow3l6c/vfCaNodI6p /vEO6A8eR+3NGmGLiGVfhMAQZTJQUXHaPQCTiUbc8Ch/1QeF9f6mMvARj9v2Ex5q5I+yCPYBnZA 6ebb8sYgyOjK0suqdb2oJeUmMt1CG1CnVaw/Sql6C2fG9kvnP5iMPiWwfwisNY+JiUliKt/rC1t 84ycfNNl9Vyw9VLFN8bFVSX7HCCSZHV4/kfZR0IC71qhZqSsbGgVgSjIEECDxqsCFaKP0ZNh0BW FJAo8EA2dTxmpdm7i3MEzNy0sYwB2Ty+pRfsLNcX+uWTCQKvlCF0pUU X-Received: by 2002:a05:6820:f027:b0:704:417f:a571 with SMTP id 006d021491bc7-70ba0b5aa65mr5537407eaf.5.1793090335832; Tue, 27 Oct 2026 01:38:55 -0700 (PDT) Received: from [127.0.0.1] ([4.150.62.85]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4a8430ec935sm6444641fac.4.2026.10.27.01.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Oct 2026 01:38:54 -0700 (PDT) Message-Id: In-Reply-To: References: From: "Harald Nordgren via GitGitGadget" Date: Tue, 27 Oct 2026 08:38:47 +0000 Subject: [PATCH v3 2/2] pretty: add %gb to name the branch of each reflog entry Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 To: git@vger.kernel.org Cc: Kristoffer Haugsbakk , "D. Ben Knoble" , Phillip Wood , Harald Nordgren , Harald Nordgren From: Harald Nordgren The reflog of HEAD records the work done on every branch, so the output of "git reflog" mixes them and does not say which entry was made on which branch. Working that out by hand means looking back for the branch switch before each entry, and a rebase can move HEAD to another branch without writing one, as "git rebase " does. 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 The branch is read from the entries that branch switches, branch renames and rebases leave behind. The entries of a rebase are named after the branch being rebased. When HEAD was detached, the entry shows "detached at " with the commit HEAD was at when it moved on. 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. 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++`[: