How to rebase a filter-branch
from a subproject on my main repository's subtree?
To me this is a normal operation to be performed with submodules. I would just to do a normal rebase as described here: Rebasing everyone onto changed git history after filter-branch
The operation I did was on my subproject, on its own repository. This was the operation:
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch "some_folder/path" -r -f' \
--prune-empty --tag-name-filter cat -- --all
After it I pushed the changes to the subproject own repository:
git push origin --force --all
git push origin --force --tags
Now I want to integrate the changes on my main repository, where my subproject is a subtree. So, this is not a normal repository. Why I do not see a rebase option on git subtree?
The solution to this would be only this: git subtree: possible to change subtree branch/path in a forked repository?, to delete it and readd it?
Tries
When doing:
git subtree pull --prefix=subprojectFolder subprojectRemoteRepository.git
The output is:
* branch master -> FETCH_HEAD
fatal: refusing to merge unrelated histories
Using git subtree merge
:
git remote add subproject_remote subprojectRemoteRepository.git
git fetch --no-tags
git checkout master
git subtree merge --prefix=subprojectFolder subproject_remote/master
fatal: refusing to merge unrelated histories
How to make them related?
Doing --allow-unrelated-histories
just results in:
error: unknown option `allow-unrelated-histories'
usage: git subtree add --prefix=<prefix> <commit>
or: git subtree add --prefix=<prefix> <repository> <ref>
or: git subtree merge --prefix=<prefix> <commit>
or: git subtree pull --prefix=<prefix> <repository> <ref>
or: git subtree push --prefix=<prefix> <repository> <ref>
or: git subtree split --prefix=<prefix> <commit...>