I have two identical GitHub repos (one is forked from the other). However, due to one of them being public I had to strip out secrets from it, so I had to change the commit history completely on that one.
I later introduced changes to both repos and I now decided that I want to move some changes from one repo to the other. Since my changes touch so many files, this will cause a lot of conflicts and i want to minimize this.
Here is a diagram that explains the current state:
To solve this, I am thinking of doing the following:
- Cherry-pick the “C” changes into “repo 1”
- Squash (D => Z + C)
- Cherry-pick the squashed commit into “repo 2”
The problem with the above approach is that i will lose the commit history due to the squash.
Another approach would be to put “C” before “D” before bringing the changes to repo 2. This however will cause conflicts on all the commits (D => Z)
What is the best approach here? Are there any other way to go around this?
Thanks