To merge customized codes upon wordpress update

Yes, WordPress replaces all the resources.

No, there is no way to get the updater to merge changes. Even in theory, I doubt you could do that. Even the big version control systems– SVN, GIT– ultimately depend on user judgment. That suggests the only reasonable answer I can think of.

You should not be hacking core files at all, but if you must you will need to use a version control system on your end to try to manage your changes and merge them with each release. Of course, the automated updater will not be involved. You will need to update manually over FTP or run GIT (or other) on the production server.

error code: 523