Julien__ Julien__ - 19 days ago 5
Git Question

How to split every commit by file?

I know how to manually split a commit using

git rebase -i
, but how can I automatically split every commit in a branch by file?

For instance, commit
A
modified 3 files, f1, f2 and f3. After the split, there are 3 commits A-f1, A-f2 and A-f3.

I want to do this to make a major rewriting easier as I will only have to squash some small commits.

Answer

For every commit, you would need

Do that in a working tree of a dedicated branch, and for every file extracted, add and commit.

Then you can reset your current branch by that new one built commit-file by commit-file.