newren / git-filter-repo

Quickly rewrite git repository history (filter-branch replacement)
Other
8.55k stars 708 forks source link

Question: Make history linear ? #493

Closed idanmiara closed 1 year ago

idanmiara commented 1 year ago

Hi, My filtered repo has merge commits, thus I cannot squash some old successive wip commits in order to cleanup history. Is there an option to linearize the history so I can squash them? I know that in some cases it might not be trivial, but in some other cases if the merge commit could have been just fast-forward, maybe it's possible to linearize naively ? Thanks!

newren commented 1 year ago

This seems more like a job for git rebase, honestly. You could try to write specialized filters to handle removing the special degenerate merge cases, but nothing exists natively in filter-repo for this, and that wouldn't clean up the old wip commits you had even if you did write such a thing. git rebase (possibly with the --rebase-merges flag if there are some merges you want to preserve just not all of them) seems like a better tool here.