Replace core files of erpnext and frappe apps

Hello, I had ERPNext v13 running and I decided to upgrade to v14. I went through alot of problems. Here’s the summary before I ask my question.

  1. I tried to upgrade from v13 ubuntu 20.04 to v14 ubuntu 22.04 but it gave alot of errors.

  2. I thought it would be easier to clean install v14 and restore sql db from v13. So, I took backup of v13, performed a clean manual install of v14. When I tried to restore, I led me in to alot of troubles. It didnot work as I had expected.

  3. Finally, I reinstalled v14, then performed a switch to branch version 13 of frappe and erpnext. It was also full of errors. At the end, I managed to get it done. v13 was running (but with no css and js). Still, I restored the old v13 backup and then finally again did the switch to branch version 14. Then I had a running v14 instance.

  4. Later during exploring I discovered: while creating a new lead, the Lead’s contact was not created. This could be because of all those errors that had occured during installation.

I realized there could be more other similar issues. I think this can be solved by replacing all the core files of erpnext and frappe apps.

Can all the files be pulled from remote server and be replaced completely (may be with bench update) without disturbing the database ?