Skip to content

Repo history filter

I worked on a git history rewrite, because I wanted to split a project that got fairly large away from my monorepo of experiments. I wanted to preserve the history, and I wanted the history for that project to only pertain to work done for that project only.

It's kind of like a Canadian history class in high-school, where a part of the history is isolated and omitted from the curriculum, and you need to go to the library to get a separate book to learn about it. We see it happen in the news a lot too.


I used filter-repo to move a subfolder’s history into a separate repo. Compared to a subtree which create a new fork in the history, I like the result of the former better, because it gave me something closer to as if I had started in a separate repo in the first place.

In a nutshell, that's all there is to it

git filter-repo --path receipts/ --path-rename receipts/: --force

For some I got a ton of conflicts when I started from a fresh remote pull. I was able to make it work by using a copy of my working folder and using the --force.

Comments