I used the git filter-branch --subdirectory-filter
option to extract two subdirectories from one repo and merge them into another repo. However, I now need to squash the commits, because any commit touching both subdirectories is now duplicated in the new repo.
To fix this, how can I programmatically merge all such commits based on some rule? In my case I know for sure that if the commit starts with "Merge PR #PRNumber" where the number is the same, that it is a duplicate and can be squashed together.
I'm thinking about writing a script that will look at the output of "git log", then find these duplicates, and do git rebase --onto commitA commitB
However I am wondering if there's a faster/git-native way to do this. Does anyone know other ways of achieving this?