I don't think this is a great analogy because computers don't have consciousness (yet).
But I usually move the hard drive (or at least its contents) between machines when I get a new computer, and that's enough for me to think of it as the "same", even if I reinstall the OS on the new machine and just copy my home directory onto the new one.
But I usually move the hard drive (or at least its contents) between machines when I get a new computer, and that's enough for me to think of it as the "same", even if I reinstall the OS on the new machine and just copy my home directory onto the new one.