I have made a “filter-branch” to remove a file permanently from the MASTER branch. This leads to an undesirable consequence that my sub-branch diverges from the MASTER-branch: “This branch is 435 commits ahead, 443 commits behind master.” Meanwhile, when I try to merge the MASTER-branch under this sub-branch, it throws “fatal: refusing to merge unrelated histories”. What should I do to make this sub-branch still in tune with the master branch? Thanks for your help.
I can do a " `–allow-unrelated-histories" commit, but it still leads to a mismatch of history between master and sub-branch: “This branch is 436 commits ahead of master.”
If you merge the “sub-branch” into master that’d reintroduce the file you have removed. The best option is probably to create a new branch starting from the modified master branch, and
cherry-pick the commits you want to keep to there.