Bench - Switch to Master/Branch

Assume a new install of Bench. There are 2 options I am interested in:

bench --switch-to-master
bench --switch-to-branch

After executing either of those commands, I immediately follow up with:
bench init frappe-bench

No matter what, bench retrieves the latest development version (7.2.18) from GitHub.
Questions:

  1. Why is bench doing this, even though I told it to switch to another version?
  2. If I’m doing this incorrectly, what is the correct way to force bench to init an older version of Frappe?

Thanks everyone! :sunny:

bench switch-to-branch develop will switch all your apps to the develop branch. This works for the current frappe-bench folder you are in. It doesn’t affect the new frappe-bench you are creating.

1 Like

Issue closed. But final notes for future readers, in case they examine this post:

When you first manually install Frappe and ERPNext. Bench will clone the complete repository from GitHub. You cannot choose (at this point) to install a particular version/branch of ERPNext. You’re stuck with the complete repository, and it will automatically use the current, active branch. No workaround for that. This isn’t a limitation of Frappe, so much as GitHub. It’s just how the “git clone” command works.

So not worrying about version yet, just do your manual installation. You’ll continue with the commands:

bench init frappe-bench
cd frappe-bench
bench get-app erpnext

Assuming everything was successful. Then and only then can you actually use a particular branch (version) of the software. By executing 1 of these commands:

frappe-bench$ bench switch-to-master
frappe-bench$ bench switch-to-develop
frappe-bench$ bench switch-to-branch <branchname>

Oh, and this automatically changes both Frappe and ERPNext at the same time. If you’re like me, this might seem pretty weird. First you download and install the software, and then you choose the version? And both Frappe and ERPNext branches change together?

Well, it’s true. Hopefully this information helps someone, so you don’t get stuck and confused like I did. :slight_smile:

Ideally, Bench should be smart enough to recognize this. So that if you try those “switch” commands before you’ve installed Frappe, you get a nice message explaining that. Instead of a Python exception. I’ve started a huge list of “To Do’s” for Bench (it drives me crazy), and will add this to the list!

28 Likes