ERPNext install fails with setup wizard : Duplicate name

I followed the suggestions in this post:

su - erpnext
cd frappe-bench/apps/frappe
git checkout -b staging
git pull upstream staging
cd ..
bench switch-to-branch staging
bench update --patch
bench setup requirements

And then the Setup Wizard completed without an error.

I’m now on these versions:

bench version
erpnext 12.x.x-develop
foundation 0.0.1
frappe 11.0.3-beta.35

Previously I had frappe 12.x.x-develop.

How to people who are using ERPNext in production manage with such a seemingly unstable code base? There must be some tricks to achieve a stable version? Or am I missing something fundamental in the way I’m doing things?