From: Philip Oakley <philipoakley@iee.email>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Git List <git@vger.kernel.org>
Subject: Re: Trimming 'deadheads' (TREESAME 2nd parent) from revision walks?
Date: Wed, 6 Oct 2021 15:03:41 +0100 [thread overview]
Message-ID: <7ac923e5-9bda-b534-a2f6-0be68fc80ed9@iee.email> (raw)
In-Reply-To: <nycvar.QRO.7.76.6.2110051244000.395@tvgsbejvaqbjf.bet>
Hi Dscho,
On 05/10/2021 11:53, Johannes Schindelin wrote:
> Hi Philip,
>
> On Sat, 18 Sep 2021, Philip Oakley wrote:
>
>> Is there a method within `git rev-list` to trim side branch merges where
>> the merge's tree is identical to the first parent's commit-tree?
> Yes, there is, but it is not as easy as a command-line option: `git
> replace`.
>
> For example, to pretend that the most recent merging-rebase in Git for
> Windows was (almost) a regular rebase, you replace the "Start the
> merging-rebase" commit with a graft that only keeps its first parent:
>
> git replace --graft HEAD^{/^Start.the} HEAD^{/^Start.the}^
If I remember rightly, the ever-green script needs to go to special
lengths to ensure that it gets the topographic (DAG) sort order, rather
than the default chrono - time ordered commit searching, which was part
of the deadheads question.
I need to learn the dot trick to avoid the quoting needed for the spaces
in the commit message title! It always slips my mind. I've added a
pseudo alias for the command style (I can never remember what I named
it.. but its easy to look up all aliases..) I also never remember that
"Start.the" subject line..
>
> (Of course, you still have to find out the first-parent-treesame merge
> commits that you want to replace.)
I was thinking of cases beyond the current Git-for-Windows, that other
maintainers may start to use where keeping the 'deadheads' is a valid,
or even required, part of their real-world projects, hence the idea of a
`--deadheads` variant of 'first-parent'.
>
> If you want to do that only temporarily, you can use a throw-away
> namespace instead of the refs/replace/ one:
>
> export GIT_REPLACE_REF_BASE=refs/philipoakley/
> git replace --graft HEAD^{/^Start.the} HEAD^{/^Start.the}^
Useful.
>
> Before:
>
> [...]
> | > | | 23e09ef1080 Merge 'remote-hg-prerequisites' into HEAD
> |/| | |
> | > | | 0221569db1c Always auto-gc after calling a fast-import transport
> | > | | f189282dcfc remote-helper: check helper status after import/export
> | > | | 158907ceb87 transport-helper: add trailing --
> | > | | 6e34e54050c t9350: point out that refs are not updated correctly
> |/ / /
> > | | 7b2b910b080 Start the merging-rebase to v2.33.0
> |\ \ \
> | |_|/
> |/| |
> | > | 508bb26ff90 (tag: v2.33.0-rc2.windows.1) Merge pull request #3349 from vdye/feature/ci-subtree-tests
> [...]
>
> After:
>
> [...]
> | > | | 23e09ef1080 Merge 'remote-hg-prerequisites' into HEAD
> |/| | |
> | > | | 0221569db1c Always auto-gc after calling a fast-import transport
> | > | | f189282dcfc remote-helper: check helper status after import/export
> | > | | 158907ceb87 transport-helper: add trailing --
> | > | | 6e34e54050c t9350: point out that refs are not updated correctly
> |/ / /
> > | / 7b2b910b080 (replaced) Start the merging-rebase to v2.33.0
> | |/
> |/|
> > | 225bc32a989 (tag: v2.33.0, upstream/maint, mirucam/maint, gitgitgadget/snap, gitgitgadget/maint) Git 2.33
> [...]
>
> You can always clean up _all_ replace objects via `git replace -d $(git
> replace -l)`.
That's a useful clean up tip. Thanks!
>
> Ciao,
> Dscho
Thanks
Philip
prev parent reply other threads:[~2021-10-06 14:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-18 14:18 Trimming 'deadheads' (TREESAME 2nd parent) from revision walks? Philip Oakley
2021-09-19 18:59 ` Jeff King
2021-09-19 23:44 ` Ævar Arnfjörð Bjarmason
2021-09-20 11:40 ` Philip Oakley
2021-09-20 20:50 ` Jeff King
2021-09-21 13:36 ` Philip Oakley
2021-09-21 18:24 ` Philip Oakley
2021-10-05 10:53 ` Johannes Schindelin
2021-10-06 14:03 ` Philip Oakley [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7ac923e5-9bda-b534-a2f6-0be68fc80ed9@iee.email \
--to=philipoakley@iee.email \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).