Safe way to upgrade ERPNext when core files are modified?

Hello Team,

I am planning to upgrade ERPNext and I have some concerns regarding existing customizations.

Currently, I have made server-side customizations by modifying core files

I understand from the forum that:

  • Client-side customizations (Custom Fields, Client Scripts, Print Formats, etc.) are usually safe during upgrades

  • Core/server-side changes may be overwritten during bench update

I came across a suggestion to:

Clone the existing system (or VM), perform the upgrade in the clone, verify functionality, and then proceed with production.

My questions are:

  1. Is cloning the environment and testing the upgrade a recommended and sufficient approach when core files are modified?

  2. Even after successful testing in a cloned environment, will bench update still overwrite the core changes in production?

  3. For existing core changes, is the only safe long-term solution to move the logic into a custom app using hooks / overrides?

  4. Are there any recommended best practices for upgrading when core changes already exist?

Any guidance from the community would be greatly appreciated.

Thanks in advance

I doubt you have any choice in this

Thats why hooks and these customizations were created by Frappe to be upgrade-safe.
So that you dont have to touch core code