You would need to perform these commands with the block at the height of the fork on each chain.
For example, suppose that chain A has a block with the hash abcdef at the height of the fork. Suppose that chain B has a block with the hash 123456 at the height of the fork.
To use chain A, you would do
invalidateblock 123456
reconsiderblock abcdef
To use chain B, you would do
invalidateblock abcdef
reconsiderblock 123456
You can use those commands to switch back and forth between blockchains.
Note that switching back and forth may result in some undefined behavior and bugs. Since such a fork has not happened before, this method has not been tested in practice. Your mileage may vary.
Thank you very much for making this SO clear! I now understand where I got it wrong: I was thinking that the invalidateblock used the block height, so not sure how that would be different from any blockchain main or fork, but clarifying that I must use the block
hash it makes perfect sense so that the specific "old" block would be identified to be removed, and the new one would start to be considered.
And now the only thing left to test is if there is a way to run two instances of Bitcoin core in the same machine...
Yes, of course. You just need to use 2 different data folders for it. And point Bitcoin Core to these 2 separate folders by command line option -datadir=....
For example 2 data folder on disk D: bitcoin-1 and bitcoin-2. Create 2 shortcuts/links to Bitcoin core with different options:
If you already use Bitcoin Core with default settings - you current data folder in your user directory. You can make copy of it to a new folder to avoid downloading / sync whole blockchain twice.