All of lore.kernel.org
 help / color / mirror / Atom feed
* Filtering commits after filtering the tree
@ 2021-12-29  9:43 Ulrich Windl
  2021-12-30 13:19 ` Son Luong Ngoc
  0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Windl @ 2021-12-29  9:43 UTC (permalink / raw)
  To: git

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).


Regards,
Urich



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Filtering commits after filtering the tree
  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
  0 siblings, 2 replies; 5+ messages in thread
From: Son Luong Ngoc @ 2021-12-30 13:19 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: git

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)

>
>
> Regards,
> Urich
>
>

Hope it helps,
Son Luong.

(1) https://github.com/newren/git-filter-repo
(2) https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#CALLBACKS

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [EXT] Re: Filtering commits after filtering the tree
  2021-12-30 13:19 ` Son Luong Ngoc
@ 2021-12-31 17:23   ` Ulrich Windl
  2021-12-31 23:48   ` Elijah Newren
  1 sibling, 0 replies; 5+ messages in thread
From: Ulrich Windl @ 2021-12-31 17:23 UTC (permalink / raw)
  To: Son Luong Ngoc; +Cc: git

On 12/30/21 2:19 PM, Son Luong Ngoc 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)

Interestingly in SLES12 SP5 there is a message recommending 
git-filter-repo, but when I had tried "man git-filter-repo" there was no 
manual page. So I did not follow that path...

> 
>>
>>
>> Regards,
>> Urich
>>
>>
> 
> Hope it helps,
> Son Luong.
> 
> (1) https://github.com/newren/git-filter-repo
> (2) https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html#CALLBACKS
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Filtering commits after filtering the tree
  2021-12-30 13:19 ` Son Luong Ngoc
  2021-12-31 17:23   ` [EXT] " Ulrich Windl
@ 2021-12-31 23:48   ` Elijah Newren
  2022-01-03  9:26     ` Antw: [EXT] " Ulrich Windl
  1 sibling, 1 reply; 5+ messages in thread
From: Elijah Newren @ 2021-12-31 23:48 UTC (permalink / raw)
  To: Son Luong Ngoc; +Cc: Ulrich Windl, git

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Antw: [EXT] Re: Filtering commits after filtering the tree
  2021-12-31 23:48   ` Elijah Newren
@ 2022-01-03  9:26     ` Ulrich Windl
  0 siblings, 0 replies; 5+ messages in thread
From: Ulrich Windl @ 2022-01-03  9:26 UTC (permalink / raw)
  To: Elijah Newren, sluongng; +Cc: git

>>> Elijah Newren <newren@gmail.com> schrieb am 01.01.2022 um 00:48 in Nachricht
<CABPp-BHnpKZ8LJzd_NL_6TGe7U3A2xPDPuvBkDQ68iTH_un6=A@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.

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-03  9:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-01-03  9:26     ` Antw: [EXT] " Ulrich Windl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.