git filter-repo is not deleting all records from git log

64 views Asked by At

I have an example git which contains 2 folders, t1 and t2, with 3 empty files each.

The log from creating the git is this:

commit 65ff445c8808326d8517dc6c5f1e7b1419f43b18 (HEAD -> main)
Author: user <[email protected]>
Date:   Thu Oct 26 15:32:16 2023 +1100

    On branch main
    Changes to be committed:
            new file:   t2/t23.txt

commit 70618523d743b8b48fdc7d79f307ff7b57080dd9
Author: user <[email protected]>
Date:   Thu Oct 26 15:31:52 2023 +1100

    On branch main
    Changes to be committed:
            new file:   t1/t13.txt

commit 5a806ae5b9e98b12c975ce0e2bf97ebdd673d3fc
Author: user <[email protected]>
Date:   Thu Oct 26 15:31:11 2023 +1100

    On branch main
    Changes to be committed:
            new file:   t1/t12.txt
            new file:   t2/t22.txt

commit bd27bd202aa66b4b9076f05336b57587ccd0e877
Author: user <[email protected]>
Date:   Thu Oct 26 15:30:23 2023 +1100

    On branch main
    
    Initial commit
    
    Changes to be committed:
            new file:   t1/t1.txt
            new file:   t2/t2.txt

The task is to delete folder t1 and all its content from git and it's history, including the log. Ie. the git should look like as if t1 and its content never existed. For that I am using

git filter-repo --invert-paths --path t1

Afterwards, the folder t1 is gone, but the log looks like this:

commit 17d3679c5c7f496dadf51865a179a21502c4b192 (HEAD -> main)
Author: user <[email protected]>
Date:   Thu Oct 26 15:32:16 2023 +1100

    On branch main
    Changes to be committed:
            new file:   t2/t23.txt

commit 47fd8d04f4173cef0b490be1e3f83474ae8dbb7a
Author: user <[email protected]>
Date:   Thu Oct 26 15:31:11 2023 +1100

    On branch main
    Changes to be committed:
            new file:   t1/t12.txt
            new file:   t2/t22.txt

commit 9d2a9082fbb3b54bc46baa309494838c162daf50
Author: user <[email protected]>
Date:   Thu Oct 26 15:30:23 2023 +1100

    On branch main
    
    Initial commit
    
    Changes to be committed:
            new file:   t1/t1.txt
            new file:   t2/t2.txt

It appears as if only the committes are erased where only folder t1 is was affected.

What I would like to see is that also all other commits are cleaned. Is this possible??

Thanks

1

There are 1 answers

0
user22804955 On
git filter-branch --msg-filter 'sed "s/^.*t1.*$//g"' main

is deleting the commit messages