Search code examples
gitsubtree

Reset diff count in git subtree


Using git-subtree, the number of diffs to calculate when running a git subtree split increases over time, reaching values that can make a split take very long.

One way to fix that is to git rm the path, commit it and then git subtree add it back.

Is there a simpler/cleaner way of resetting a subtree?


Solution

  • When doing the split the --rejoin option can be used, which seems to exist exactly to reuse the splits that have already happened.

    --rejoin::

    This option is only valid for the split command.

    After splitting, merge the newly created synthetic history back into your main project. That way, future splits can search only the part of history that has been added since the most recent --rejoin.

    From https://github.com/apenwarr/git-subtree/blob/master/git-subtree.txt