git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Elijah Newren <newren@gmail.com>
To: Son Luong Ngoc <sluongng@gmail.com>
Cc: Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de>,
	git <git@vger.kernel.org>
Subject: Re: Filtering commits after filtering the tree
Date: Fri, 31 Dec 2021 15:48:17 -0800	[thread overview]
Message-ID: <CABPp-BHnpKZ8LJzd_NL_6TGe7U3A2xPDPuvBkDQ68iTH_un6=A@mail.gmail.com> (raw)
In-Reply-To: <CAL3xRKet7KXTx+6ALVZCxeFRkU3guwNc6GtAT1iofB=UKqj2fg@mail.gmail.com>

On Fri, Dec 31, 2021 at 2:27 AM Son Luong Ngoc <sluongng@gmail.com> wrote:
>
> Hi Ulrich,
>
> On Thu, Dec 30, 2021 at 12:28 PM Ulrich Windl
> <Ulrich.Windl@rz.uni-regensburg.de> 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.

  parent reply	other threads:[~2021-12-31 23:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29  9:43 Filtering commits after filtering the tree Ulrich Windl
2021-12-30 13:19 ` Son Luong Ngoc
2021-12-31 17:23   ` [EXT] " Ulrich Windl
2021-12-31 23:48   ` Elijah Newren [this message]
2022-01-03  9:26     ` Antw: " Ulrich Windl

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='CABPp-BHnpKZ8LJzd_NL_6TGe7U3A2xPDPuvBkDQ68iTH_un6=A@mail.gmail.com' \
    --to=newren@gmail.com \
    --cc=Ulrich.Windl@rz.uni-regensburg.de \
    --cc=git@vger.kernel.org \
    --cc=sluongng@gmail.com \
    /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).