This depends on your take on the mind-body problem. Is the brain the mind? Then why does the memory of my grandmother look like my grandmother? Literally? Like a photograph? There is no literal image of grandma in my brain. There are neurons in the occipital cortex that could produce such an image, if stimulated properly. But where is the image? (Contradicting John Searle here) Consider the analogy of the computer you are using. It has input devices (keyboard, mouse) that are like sensory input, a central processor and memory like the brain, and output (monitor) like the visual imagination. It executes programs/algorithms (thoughts, ideas) which work with stored memories. Both the computer and the mind use logic. Both use logic gates at the lowest level. So if the human mind is a computer, like a machine, is not the mind merely the brain, and our visual imagination a by-product, an epiphenomenon? The use of the word “merely” is always a give-away that this is a materialist solution. Materialism is attractive to some scientists and most engineers who have never thought deeply about this problem. It is not attractive to philosophers, because we realize that “matter” is a hypothetical construct. It is not something we sense directly. When we see and touch the table in front of us, what we sense are color, hardness, extension, and so on, which are sensations. We hypothesize something underlying these sensations is matter. This is called naive realism. No philosopher since the 18th century ( Berkeley, Hume, Kant) has maintained this belief. Today simple chemistry tells that hardness is not hard at all. It is merely (that word again) the repulsion of the electromagnetic forces in our hand and the same forces in the table. The color is the stimulus of the cones in our retina by light of certain wave lengths. Smell and taste are merely (!) chemical reactions in sensory organs that stimulate neurons. Sensation is the accumulation of these data and the construct of “reality” somewhere else. This somewhere else is the mind. So where is the mind? The same place as the square root of two.
Getting back to the question, what would happen if we all had our brains replaced with new, identical brains overnight. I am going to make a big assumption here and guess that the crew that did this were careful to make back-ups before the hardware upgrade was executed. After the upgrade all the memory and software was restored. When I was working in IT this happened about once a year. I would leave on Friday, not suspecting a thing. I would return on Monday, and there on my desk was a shiny new computer. I would turn it on and find the same friendly old desk top I left on Friday. The computer was faster and had more available memory, but nothing really had changed. This is the same idea as th upgrade to our brains we envision. Nothing meaningful would change.
Now envision a more radical change. Suppose our old Windows computer was replaced with a Unix machine running a Windows emulation? Then the next upgrade replaces that with a Mac, running the same software. Is this still “our” computer, the one we left that fateful Friday? Suppose in the future our entire system, programs and software is transferred to the Cloud and we work from a tablet like the one I am using now. Is this still “my” system? Envision a system that stimulates our brains directly without any hardware. Hard to imagine, but a possibility in the future. Now what if our minds were backed-up to the Cloud? The hardware is no longer necessary.
Consider, God’s memory is eternal. It is not even possible for God to forget. Can you see your way clear to understanding “the immortality of the soul”? “But couldn’t we be implemented on another platform? Like a gnat if we were really awful people? Doesn't this model support reincarnation?” Yes it does. That is a result I did not expect when I pursued this line of reasoning (went down this rabbit hole). But if we are truly philosophical, we must allow for that possibility, even if it goes against the grain of everything we believe ( or supports everything you believe if you are Hindu or Buddhist).
“ But what if we don't believe in God? What if we are furious that God has ordered the affairs of the world like this?” What if we die unreconciled to God? I suppose immortality would be most unpleasant.