ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

How to commit changes

Hi i made changes for some doctypes. When i try do bench update i get this error?

What does it mean in non-techy terms:

frappe@erpnext:~/frappe-bench$ bench update
INFO:bench.utils:updating bench
INFO:bench.utils:git pull
remote: Enumerating objects: 668, done.
remote: Counting objects: 100% (542/542), done.
remote: Compressing objects: 100% (136/136), done.
remote: Total 383 (delta 255), reused 340 (delta 227), pack-reused 0
Receiving objects: 100% (383/383), 69.30 KiB | 375.00 KiB/s, done.
Resolving deltas: 100% (255/255), completed with 45 local objects.
From https://github.com/frappe/bench
** 7051aa3…8d79219 master -> origin/master**
Updating 7051aa3…8d79219
Fast-forward
** .github/ISSUE_TEMPLATE/bug-report.md | 47 +++**
** .github/ISSUE_TEMPLATE/bug_report.md | 68 ----**
** .github/ISSUE_TEMPLATE/easy-install.md | 43 +++**
** …/{feature_request.md => feature-request.md} | 2 ±**
** …/ISSUE_TEMPLATE/questions-about-using-bench.md | 19 +**
** .github/PULL_REQUEST_TEMPLATE.md | 53 +±**
** README.md | 234 +++±--------**
** bench/app.py | 27 ±**
** bench/cli.py | 7 ±**
** bench/commands/init.py | 3 ±**
** bench/commands/install.py | 2 ±**
** bench/commands/make.py | 48 +±**
** bench/commands/setup.py | 3 ±**
** bench/commands/update.py | 22 ±**
** bench/commands/utils.py | 10 ±**
** bench/config/nginx.py | 5 ±**
** bench/config/templates/nginx.conf | 19 ±**
** bench/utils.py | 148 ++++±–**
** docs/commands_and_usage.md | 69 ++++**
** docs/contribution_guidelines.md | 4 ±**
** docs/easy_install.md | 91 +++++**
** docs/installation.md | 38 ++**
** …g_frappe_erpext.md => releasing_frappe_apps.md} | 0**
** playbooks/install.py | 381 ++++++++++±---------**
** playbooks/macosx.yml | 28 ±**
** playbooks/roles/bench/tasks/main.yml | 11 ±**
** …/roles/bench/tasks/setup_bench_production.yml | 2 ±**
** playbooks/roles/bench/tasks/setup_firewall.yml | 10 ±**
** playbooks/roles/common/tasks/debian.yml | 65 +±-**
** playbooks/roles/common/tasks/debian_family.yml | 60 +±-**
** playbooks/roles/common/tasks/macos.yml | 20 ±**
** playbooks/roles/common/tasks/redhat_family.yml | 77 ++±-**
** playbooks/roles/common/tasks/ubuntu.yml | 53 ±-**
** playbooks/roles/frappe_selinux/tasks/main.yml | 9 ±**
** playbooks/roles/mariadb/tasks/centos.yml | 15 ±**
** playbooks/roles/mariadb/tasks/debian.yml | 26 ±**
** playbooks/roles/mariadb/tasks/main.yml | 22 ±**
** playbooks/roles/mariadb/tasks/ubuntu-trusty.yml | 16 ±**
** …/roles/mariadb/tasks/ubuntu-xenial_bionic.yml | 16 ±**
** playbooks/roles/nginx/tasks/setup-Debian.yml | 8 ±**
** playbooks/roles/nodejs/tasks/debian_family.yml | 6 ±**
** playbooks/roles/ntpd/tasks/main.yml | 18 ±**
** playbooks/roles/packer/tasks/debian_family.yml | 8 ±**
** playbooks/roles/packer/tasks/main.yml | 12 ±**
** playbooks/roles/packer/tasks/redhat_family.yml | 7 ±**
** playbooks/roles/redis/tasks/main.yml | 22 ±**
** playbooks/roles/virtualbox/tasks/debian_family.yml | 17 ±**
** playbooks/roles/virtualbox/tasks/redhat_family.yml | 9 ±**
** playbooks/roles/wkhtmltopdf/tasks/main.yml | 27 ±**
** 49 files changed, 1147 insertions(+), 760 deletions(-)**
** create mode 100644 .github/ISSUE_TEMPLATE/bug-report.md**
** delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md**
** create mode 100644 .github/ISSUE_TEMPLATE/easy-install.md**
** rename .github/ISSUE_TEMPLATE/{feature_request.md => feature-request.md} (96%)**
** create mode 100644 .github/ISSUE_TEMPLATE/questions-about-using-bench.md**
** create mode 100644 docs/commands_and_usage.md**
** create mode 100644 docs/easy_install.md**
** create mode 100644 docs/installation.md**
** rename docs/{releasing_frappe_erpext.md => releasing_frappe_apps.md} (100%)**
remote: Enumerating objects: 2361, done.
remote: Counting objects: 100% (2361/2361), done.
remote: Compressing objects: 100% (71/71), done.
Receiving objects: 100% (3781/3781), 1.01 MiB | 603.00 KiB/s, done.
remote: Total 3781 (delta 2321), reused 2305 (delta 2290), pack-reused 1420
Resolving deltas: 100% (2772/2772), completed with 458 local objects.
From https://github.com/frappe/frappe
** d3df0527b…5aa81ee77 version-12 -> upstream/version-12**
** 8a11fb57c…4a8208c72 develop -> upstream/develop**
** b0a1e9bf8…80f666789 v11-pre-release -> upstream/v11-pre-release**
** 94a211edb…8748ffb37 v12-pre-release -> upstream/v12-pre-release**
** b0a1e9bf8…80f666789 version-11 -> upstream/version-11**
** 5e1623f88…4c111507f version-11-hotfix -> upstream/version-11-hotfix**
** 0201cfe6f…5f4dd06be version-12-hotfix -> upstream/version-12-hotfix**
** * [new tag] v11.1.64 -> v11.1.64**
** * [new tag] v12.2.1 -> v12.2.1**
** * [new tag] v11.1.63 -> v11.1.63**
** * [new tag] v12.1.0 -> v12.1.0**
** * [new tag] v12.2.0 -> v12.2.0**
INFO:bench.utils:./env/bin/pip install Pillow
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Ple ase upgrade your Python as Python 2.7 won’t be maintained after that date. A fut ure version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/relea se-process/#python-2-support
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages (6.1. 0)
Backing up sites…

Cannot proceed with update: You have local changes in app “frappe” that are not committed.

Here are your choices:

1. Merge the frappe app manually with “git pull” / “git pull --rebase” and fix c onflicts.
1. Temporarily remove your changes with “git stash” or discard them completely
** with “bench update --reset” or for individual repositries “git reset --h ard”**
2. If your changes are helpful for others, send in a pull request via GitHub and
** wait for them to be merged in the core.**

  1. I assume that the changes have been made directly to the JSON/py/js file?

  2. When you change anything in the core code, it creates an update problem as there is a difference in the commit history made locally v/s in the incoming changes. Check

  3. If you want to keep these changes, stash them and re-apply the changes.

  1. If you do not want to keep the changes, you can go to the frappe directory and reset it: git reset --hard. Or pass the reset flag when updating bench: bench update --reset

  2. When making changes, it is best to avoid code changes directly until unavoidable. For adding fields you can look at custom field option. For making server-side changes, you have the option of custom apps and server scripts, same for js changes.

1 Like

To get an idea of how best to make changes posts like this explain what to do

Edit: Here’s another good explanation How do you deploy changes to production env?

@kennethsequeira The changes that i have made are not on the PY scripts but only doctype customizations. (Not sure if these touch on the JSOn/py/js files in the backend).

@clarkej Hi i have read the post and am a little bit concerned that the article only mentions that making changes will create issues during update but doesnt specify how to mitigate this update issue. From the error i got does doing the git pull or git pull --rebase fix the conflict issues arising as a result of customization? This is a concern for me as one might want to change one or two doctypes fields from the front end and this small changes doesnt necessary have to affect the updating of the entire system.

Kindly clarrify if there is something i havent understood clearly especially in how to commit the changes so as not to have update issues. Thanks in advance.

@ben can you tell us the steps taken to create or update these fields?

@kennethsequeira For example in Doctype student applicant, i added a field named “Nationa ID Number”. For me to add this field. i went through the following steps:

Website module>web forms>student applicant>menu>customize>Add row for National ID Number.

This is the method i normally use when customizing a doctype. I use the customize option under menu in the doctype that i want to modify. I never touch the scripts as am not a developer.

If you’ve made the change via customize form, there shouldn’t be an issue.

On your server go to the frappe directory under frappe-bench/apps/frappe and run git status to check what files were modified.

@kennethsequeira currently my working tree is clean. Its because i had reset all my changes during update with the “bench update --reset”.

Assuming i had some changes and my working tree wasnt clean, how would i go about it during an update?

Changes made via customize form option do not cause local change problems since they’re directly managed via the db. Something else had likely caused the issue.

If this occurs again, run git status in the app’s directory to see what has changed.

Sure i will do that to see if there will be anything. Thanks for your insights.

Hello, could you please explain the point 3?
where should i be in folders, to be able to stash the custom code for ERPnext?
after I stach the custom code, I run the bench update?
and how do i pull those stashed changes after update?
Thank you for help

You’ll have to re-apply the changes:

I stashed the changes, then after bench update --reset
I used git stash apply, I applied the correct stash.
I think those files are changed but ERPnext website still does not show that modified layout
I restarted server too