{"thread":{"id":"57163","subject":"Filtering commits after filtering the tree","startedAt":"2021-12-29T09:51:16Z","lastAt":"2022-01-03T09:26:25Z","messageCount":5,"participants":["Ulrich Windl","Son Luong Ngoc","Elijah Newren"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"445171","messageId":"61CC2DD2020000A10004691F@gwsmtp.uni-regensburg.de","threadId":"57163","inReplyTo":null,"subject":"Filtering commits after filtering the tree","fromName":"Ulrich Windl","fromEmail":"ulrich.windl@rz.uni-regensburg.de","sentAt":"2021-12-29T09:43:46Z","receivedAt":"2021-12-29T09:51:16Z","isPatch":false,"sender":{"key":"ulrich.windl@rz.uni-regensburg.de","avatar":null},"body":"Hi guys!\n\n\nAs  I know there are really smart ones around, please don't laugh how I helped myself with this problem:\nhttps://stackoverflow.com/q/70505903/6607497\nI'm sure you wouldn't have wasted hours with rebasing interactively...\n\n\nFeel free to comment either on the list or at SO (comment or improved answer).\n\n\nRegards,\nUrich\n\n\n"},{"id":"445220","messageId":"CAL3xRKet7KXTx+6ALVZCxeFRkU3guwNc6GtAT1iofB=UKqj2fg@mail.gmail.com","threadId":"57163","inReplyTo":"61CC2DD2020000A10004691F@gwsmtp.uni-regensburg.de","subject":"Re: Filtering commits after filtering the tree","fromName":"Son Luong Ngoc","fromEmail":"sluongng@gmail.com","sentAt":"2021-12-30T13:19:49Z","receivedAt":"2021-12-30T13:20:03Z","isPatch":false,"sender":{"key":"sluongng@gmail.com","avatar":"https://avatars.githubusercontent.com/u/26684313?v=4"},"body":"Hi Ulrich,\n\nOn Thu, Dec 30, 2021 at 12:28 PM Ulrich Windl\n<Ulrich.Windl@rz.uni-regensburg.de> wrote:\n>\n> Hi guys!\n>\n>\n> As  I know there are really smart ones around, please don't laugh how I helped myself with this problem:\n> https://stackoverflow.com/q/70505903/6607497\n> I'm sure you wouldn't have wasted hours with rebasing interactively...\n>\n>\n> Feel free to comment either on the list or at SO (comment or improved answer).\n\nYou probably want to try git-filter-repo (1)\nwhile using `--message-callback` as documented in (2)\n\n>\n>\n> Regards,\n> Urich\n>\n>\n\nHope it helps,\nSon Luong.\n\n(1) https://github.com/newren/git-filter-repo\n(2) https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#CALLBACKS\n"},{"id":"445292","messageId":"9ba1551b-375c-fe71-3402-8a54dbeec085@rz.uni-regensburg.de","threadId":"57163","inReplyTo":"CAL3xRKet7KXTx+6ALVZCxeFRkU3guwNc6GtAT1iofB=UKqj2fg@mail.gmail.com","subject":"Re: [EXT] Re: Filtering commits after filtering the tree","fromName":"Ulrich Windl","fromEmail":"ulrich.windl@rz.uni-regensburg.de","sentAt":"2021-12-31T17:23:12Z","receivedAt":"2021-12-31T17:23:17Z","isPatch":false,"sender":{"key":"ulrich.windl@rz.uni-regensburg.de","avatar":null},"body":"On 12/30/21 2:19 PM, Son Luong Ngoc wrote:\n> Hi Ulrich,\n> \n> On Thu, Dec 30, 2021 at 12:28 PM Ulrich Windl\n> <Ulrich.Windl@rz.uni-regensburg.de> wrote:\n>>\n>> Hi guys!\n>>\n>>\n>> As  I know there are really smart ones around, please don't laugh how I helped myself with this problem:\n>> https://stackoverflow.com/q/70505903/6607497\n>> I'm sure you wouldn't have wasted hours with rebasing interactively...\n>>\n>>\n>> Feel free to comment either on the list or at SO (comment or improved answer).\n> \n> You probably want to try git-filter-repo (1)\n> while using `--message-callback` as documented in (2)\n\nInterestingly in SLES12 SP5 there is a message recommending \ngit-filter-repo, but when I had tried \"man git-filter-repo\" there was no \nmanual page. So I did not follow that path...\n\n> \n>>\n>>\n>> Regards,\n>> Urich\n>>\n>>\n> \n> Hope it helps,\n> Son Luong.\n> \n> (1) https://github.com/newren/git-filter-repo\n> (2) https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#CALLBACKS\n> \n"},{"id":"445298","messageId":"CABPp-BHnpKZ8LJzd_NL_6TGe7U3A2xPDPuvBkDQ68iTH_un6=A@mail.gmail.com","threadId":"57163","inReplyTo":"CAL3xRKet7KXTx+6ALVZCxeFRkU3guwNc6GtAT1iofB=UKqj2fg@mail.gmail.com","subject":"Re: Filtering commits after filtering the tree","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2021-12-31T23:48:17Z","receivedAt":"2021-12-31T23:48:33Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Fri, Dec 31, 2021 at 2:27 AM Son Luong Ngoc <sluongng@gmail.com> wrote:\n>\n> Hi Ulrich,\n>\n> On Thu, Dec 30, 2021 at 12:28 PM Ulrich Windl\n> <Ulrich.Windl@rz.uni-regensburg.de> wrote:\n> >\n> > Hi guys!\n> >\n> >\n> > As  I know there are really smart ones around, please don't laugh how I helped myself with this problem:\n> > https://stackoverflow.com/q/70505903/6607497\n> > I'm sure you wouldn't have wasted hours with rebasing interactively...\n> >\n> >\n> > Feel free to comment either on the list or at SO (comment or improved answer).\n>\n> You probably want to try git-filter-repo (1)\n> while using `--message-callback` as documented in (2)\n\nIn particular, you'd get most of the way there with a simple\n\n   git filter-repo --path my-module/\n\nThat will remove all files not under my-module/ from the repository,\nAND remove all commits that become empty due to removing all the other\nfiles.\n\n\nIf you had commits which both touched my-module/ and also made\nreference to other files outside of my-module/, then you may also want\nto clean those up.  If that's something you can write code to do\n(perhaps because the commit messages were regular, or you are an\nexpert at parsing and rewriting natural language programatically),\nthen the --message-callback suggested by Son could help you out.  That\nsounds difficult to me, because I don't know how to even identify such\ncommits without having a human being read every single one.\n\nBut it sounded to me like most of the commit messages you didn't want\nwere ones that just touched paths outside of your selected module, in\nwhich case the simple path filtering I suggested above would clear\nthose all out for you.\n"},{"id":"445344","messageId":"61D2C138020000A100046A21@gwsmtp.uni-regensburg.de","threadId":"57163","inReplyTo":"CABPp-BHnpKZ8LJzd_NL_6TGe7U3A2xPDPuvBkDQ68iTH_un6=A@mail.gmail.com","subject":"Antw: [EXT] Re: Filtering commits after filtering the tree","fromName":"Ulrich Windl","fromEmail":"ulrich.windl@rz.uni-regensburg.de","sentAt":"2022-01-03T09:26:16Z","receivedAt":"2022-01-03T09:26:25Z","isPatch":false,"sender":{"key":"ulrich.windl@rz.uni-regensburg.de","avatar":null},"body":">>> Elijah Newren <newren@gmail.com> schrieb am 01.01.2022 um 00:48 in Nachricht\n<CABPp-BHnpKZ8LJzd_NL_6TGe7U3A2xPDPuvBkDQ68iTH_un6=A@mail.gmail.com>:\n> On Fri, Dec 31, 2021 at 2:27 AM Son Luong Ngoc <sluongng@gmail.com> wrote:\n>>\n>> Hi Ulrich,\n>>\n>> On Thu, Dec 30, 2021 at 12:28 PM Ulrich Windl\n>> <Ulrich.Windl@rz.uni-regensburg.de> wrote:\n>> >\n>> > Hi guys!\n>> >\n>> >\n>> > As  I know there are really smart ones around, please don't laugh how I \n> helped myself with this problem:\n>> > https://stackoverflow.com/q/70505903/6607497 \n>> > I'm sure you wouldn't have wasted hours with rebasing interactively...\n>> >\n>> >\n>> > Feel free to comment either on the list or at SO (comment or improved \n> answer).\n>>\n>> You probably want to try git-filter-repo (1)\n>> while using `--message-callback` as documented in (2)\n> \n> In particular, you'd get most of the way there with a simple\n> \n>    git filter-repo --path my-module/\n> \n> That will remove all files not under my-module/ from the repository,\n> AND remove all commits that become empty due to removing all the other\n> files.\n> \n> \n> If you had commits which both touched my-module/ and also made\n> reference to other files outside of my-module/, then you may also want\n> to clean those up.  If that's something you can write code to do\n> (perhaps because the commit messages were regular, or you are an\n> expert at parsing and rewriting natural language programatically),\n> then the --message-callback suggested by Son could help you out.  That\n> sounds difficult to me, because I don't know how to even identify such\n> commits without having a human being read every single one.\n> \n> But it sounded to me like most of the commit messages you didn't want\n> were ones that just touched paths outside of your selected module, in\n> which case the simple path filtering I suggested above would clear\n> those all out for you.\n\nYes, 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).\n(I know changelogs are a bad idea)\n\nI'll try your proposal next time. Writing custom Python filters is too much for me at the moment...\n\nThanks and kind Regards (and a happy new year),\nUlrich\n\n\n\n\n"}]}