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: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id C50B41F953 for ; Mon, 3 Jan 2022 09:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbiACJ0Z convert rfc822-to-8bit (ORCPT ); Mon, 3 Jan 2022 04:26:25 -0500 Received: from mx1.uni-regensburg.de ([194.94.157.146]:44664 "EHLO mx1.uni-regensburg.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229516AbiACJ0Y (ORCPT ); Mon, 3 Jan 2022 04:26:24 -0500 Received: from mx1.uni-regensburg.de (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id CBB12600004E for ; Mon, 3 Jan 2022 10:26:18 +0100 (CET) Received: from gwsmtp.uni-regensburg.de (gwsmtp1.uni-regensburg.de [132.199.5.51]) by mx1.uni-regensburg.de (Postfix) with ESMTP id A363B600004D for ; Mon, 3 Jan 2022 10:26:18 +0100 (CET) Received: from uni-regensburg-smtp1-MTA by gwsmtp.uni-regensburg.de with Novell_GroupWise; Mon, 03 Jan 2022 10:26:19 +0100 Message-Id: <61D2C138020000A100046A21@gwsmtp.uni-regensburg.de> X-Mailer: Novell GroupWise Internet Agent 18.3.1 Date: Mon, 03 Jan 2022 10:26:16 +0100 From: "Ulrich Windl" To: "Elijah Newren" , Cc: Subject: Antw: [EXT] Re: Filtering commits after filtering the tree References: <61CC2DD2020000A10004691F@gwsmtp.uni-regensburg.de> In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8BIT Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org >>> Elijah Newren schrieb am 01.01.2022 um 00:48 in Nachricht : > On Fri, Dec 31, 2021 at 2:27 AM Son Luong Ngoc wrote: >> >> Hi Ulrich, >> >> On Thu, Dec 30, 2021 at 12:28 PM Ulrich Windl >> wrote: >> > >> > Hi guys! >> > >> > >> > As I know there are really smart ones around, please don't laugh how I > helped myself with this problem: >> > https://stackoverflow.com/q/70505903/6607497 >> > I'm sure you wouldn't have wasted hours with rebasing interactively... >> > >> > >> > Feel free to comment either on the list or at SO (comment or improved > answer). >> >> You probably want to try git-filter-repo (1) >> while using `--message-callback` as documented in (2) > > In particular, you'd get most of the way there with a simple > > git filter-repo --path my-module/ > > That will remove all files not under my-module/ from the repository, > AND remove all commits that become empty due to removing all the other > files. > > > If you had commits which both touched my-module/ and also made > reference to other files outside of my-module/, then you may also want > to clean those up. If that's something you can write code to do > (perhaps because the commit messages were regular, or you are an > expert at parsing and rewriting natural language programatically), > then the --message-callback suggested by Son could help you out. That > sounds difficult to me, because I don't know how to even identify such > commits without having a human being read every single one. > > But it sounded to me like most of the commit messages you didn't want > were ones that just touched paths outside of your selected module, in > which case the simple path filtering I suggested above would clear > those all out for you. Yes, as I had a changelog type of file I had many commits describing changes in changelog that refer to files that are no longer part of the repository (commits for the files themselves had vanished already). (I know changelogs are a bad idea) I'll try your proposal next time. Writing custom Python filters is too much for me at the moment... Thanks and kind Regards (and a happy new year), Ulrich