From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.6 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id D9B491F803 for ; Wed, 9 Jan 2019 14:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730413AbfAIOF4 (ORCPT ); Wed, 9 Jan 2019 09:05:56 -0500 Received: from mout.gmx.net ([212.227.15.15]:56961 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729603AbfAIOF4 (ORCPT ); Wed, 9 Jan 2019 09:05:56 -0500 Received: from [192.168.0.129] ([37.201.193.149]) by mail.gmx.com (mrgmx003 [212.227.17.190]) with ESMTPSA (Nemesis) id 0LiDrv-1h3JVh1six-00nNDr; Wed, 09 Jan 2019 15:05:54 +0100 Date: Wed, 9 Jan 2019 15:05:38 +0100 (STD) From: Johannes Schindelin X-X-Sender: virtualbox@gitforwindows.org To: Jacob Keller cc: Markus Wiederkehr , Git mailing list Subject: Re: git rebase: retain original head? In-Reply-To: Message-ID: References: <87va2zavu1.fsf@igel.home> User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K1:YrdRyEGjxnZEa+JSeycstx/LWmX56Lc8zQ1XYrf+0iaJhh4zdJT HwCW/dMtiJXV3eg1T5JdjFtT7OamMhyuGawQQkAAdFfSg8bB+BaZVFEwvBWlxxG0LIaRMHU JCc4K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MYoQWfv5TiZSu2q3gXBGocZP llxFe6xge+w== Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Hi Jake, On Tue, 8 Jan 2019, Jacob Keller wrote: > On Tue, Jan 8, 2019 at 12:47 PM Markus Wiederkehr > wrote: > > > > On Tue, Jan 8, 2019 at 6:43 PM Andreas Schwab wrote: > > > > > > On Jan 08 2019, Markus Wiederkehr wrote: > > > > > > > Would it be possible to retain this information? > > > > > > You could use the reflog of the current branch, where it is the second > > > entry. > > > > It is not, depending on what happens in the rebase it could be any > > entry. That's why I always have to search for the right one, which is > > tedious. > > > > Example: > > > > $ git rebase -i root-tag > > ... (apply one fixup) > > $ git reflog > > 906caf1c (HEAD -> master) HEAD@{0}: rebase -i (finish): returning to > > refs/heads/master > > 4906caf1c (HEAD -> master) HEAD@{1}: rebase -i (pick): qux > > 85dab37b4 HEAD@{2}: rebase -i (pick): baz > > 7de7420d2 HEAD@{3}: rebase -i (fixup): bar > > 9bc0461c0 HEAD@{4}: rebase -i (start): checkout root-tag > > a150b73ca HEAD@{5}: commit: foo > > > > Here I have to use HEAD@{5}. > > > > He meant using: > > $ git reflog master Indeed. That's why terse answers are often worse than no answers at all: more often than not, they leave things unclearer than before, in the worst case they are misleading, as was the very terse first reply. Just don't. Too short is not beautiful. > which only shows changes directly to the master ref, not to HEAD. > During a git rebase operations don't modify the master ref until after > the rebase finishes. This, of course, assumes you're on a branch. > > If so, you should even be able to use master@{1} and be safe in > assuming it always refers to what the branch was before the rebase > started. There are more tricks up Git's sleeves: @{1} is a shorthand for the previous state of the current branch (if any). So after you rebase a branch, @{1} will refer to what previously was ORIG_HEAD. Having said that, it is an unintended regression in the built-in rebase. Markus, could you come up with a minimal test case, preferably in the form of a patch to t/t3415-rebase-autosquash.sh? Thanks, Johannes