Re: Filtering commits after filtering the tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux