Trimming git history for Yii 3 packages

Some Yii packages, such as https://github.com/yiisoft/yii-dataview were split directly from Yii 2 so they have whole Yii 2 commits history:

image

Do you think we need to trim commit history?

  • Yes
  • No

0 voters

OK. That would need some coordination since commit IDs will be changed after history rewrite.

Here’s a plan:

  1. Get a list of repositories to truncate.
  2. Merge/decline all pull requests.
  3. Choose a point to truncate to. Either individually or choose a data like 1st January 2019.
  4. Trim each repo using grafts and filter-branch.
  5. Verify that everything’s OK.
  6. Force-push.

Package repo should contains only commits that concerns this repo.

Any idea on how to filter commits like that?

I think its not possible, even if you check affected files and filter out commits, some of them may also include not wanted files or commits may by not atomic and concern changes out of package scope.
So in the end git history will be bad…

I did that years ago, a entrypoint could be https://git-scm.com/docs/git-filter-branch

You filter commit by a certain path. Every commit without changes in a specific dir is discarded.

(addon) https://help.github.com/en/github/using-git/splitting-a-subfolder-out-into-a-new-repository

1 Like