To switch from ‘develop’ to ‘staging’ branch I did this -
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git branch -a
* develop
master
remotes/origin/bcornwellmott-patch-1
remotes/origin/bcornwellmott-patch-2
remotes/origin/develop
remotes/origin/forellana-digithinkit-patch-1
remotes/origin/gh-pages
remotes/origin/hotfix
remotes/origin/master
remotes/origin/ppt_fix_qty
remotes/origin/revert-7409-daterangecontrol
remotes/origin/stock_reports
remotes/origin/v4.x.x
remotes/origin/v5.x.x
remotes/origin/v6.x.x
remotes/origin/v7.0.x
remotes/upstream/master
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git config --unset-all remote.upstream.fetch
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git config --add remote.upstream.fetch ‘+refs/heads/*:refs/remotes/upstream/*’
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git fetch upstream
remote: Enumerating objects: 589, done.
remote: Counting objects: 100% (589/589), done.
remote: Compressing objects: 100% (32/32), done.
remote: Total 766 (delta 566), reused 572 (delta 557), pack-reused 177
Receiving objects: 100% (766/766), 2.62 MiB | 1.97 MiB/s, done.
Resolving deltas: 100% (627/627), completed with 381 local objects.
From GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)
* [new branch] coverage-badge → upstream/coverage-badge
* [new branch] develop → upstream/develop
* [new branch] hotfix → upstream/hotfix
* [new branch] intellisense-fix → upstream/intellisense-fix
* [new branch] python3-super-fix → upstream/python3-super-fix
* [new branch] staging → upstream/staging
* [new branch] staging-fixes → upstream/staging-fixes
* [new branch] v4.x.x → upstream/v4.x.x
* [new branch] v5.x.x → upstream/v5.x.x
* [new branch] v6.x.x → upstream/v6.x.x
* [new branch] v7.0.x → upstream/v7.0.x
* [new branch] v7.x.x → upstream/v7.x.x
* [new branch] v8.x.x → upstream/v8.x.x
* [new branch] v9.x.x → upstream/v9.x.x
* [new branch] validate-fy-dates-1 → upstream/validate-fy-dates-1
* [new tag] v11.0.3-beta.2 → v11.0.3-beta.2
* [new tag] v11.0.1 → v11.0.1
* [new tag] v11.0.2 → v11.0.2
* [new tag] v11.0.3 → v11.0.3
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git branch -a
* develop
master
remotes/origin/bcornwellmott-patch-1
remotes/origin/bcornwellmott-patch-2
remotes/origin/develop
remotes/origin/forellana-digithinkit-patch-1
remotes/origin/gh-pages
remotes/origin/hotfix
remotes/origin/master
remotes/origin/ppt_fix_qty
remotes/origin/revert-7409-daterangecontrol
remotes/origin/stock_reports
remotes/origin/v4.x.x
remotes/origin/v5.x.x
remotes/origin/v6.x.x
remotes/origin/v7.0.x
remotes/upstream/coverage-badge
remotes/upstream/develop
remotes/upstream/hotfix
remotes/upstream/intellisense-fix
remotes/upstream/master
remotes/upstream/python3-super-fix
remotes/upstream/staging
remotes/upstream/staging-fixes
remotes/upstream/v4.x.x
remotes/upstream/v5.x.x
remotes/upstream/v6.x.x
remotes/upstream/v7.0.x
remotes/upstream/v7.x.x
remotes/upstream/v8.x.x
remotes/upstream/v9.x.x
remotes/upstream/validate-fy-dates-1
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git checkout staging
error: Your local changes to the following files would be overwritten by checkout:
erpnext/accounts/doctype/sales_invoice/sales_invoice.py
erpnext/controllers/buying_controller.py
Please, commit your changes or stash them before you can switch branches.
Aborting
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git status
On branch develop
Changes not staged for commit:
(use “git add …” to update what will be committed)
(use “git checkout – …” to discard changes in working directory)
modified: erpnext/accounts/doctype/sales_invoice/sales_invoice.py
modified: erpnext/controllers/buying_controller.py
modified: erpnext/controllers/selling_controller.py
no changes added to commit (use “git add” and/or “git commit -a”)
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git reset --hard
HEAD is now at dc4c83a Merge branch ‘develop’ of GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP) into develop
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git checkout staging
Branch staging set up to track remote branch staging from upstream.
Switched to a new branch ‘staging’
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git status
On branch staging
Your branch is up-to-date with ‘upstream/staging’.
nothing to commit, working directory clean
frappe@ubuntu:~/frappe-bench/apps/erpnext$ git branch -a
develop
master
* staging
remotes/origin/bcornwellmott-patch-1
remotes/origin/bcornwellmott-patch-2
remotes/origin/develop
remotes/origin/forellana-digithinkit-patch-1
remotes/origin/gh-pages
remotes/origin/hotfix
remotes/origin/master
remotes/origin/ppt_fix_qty
remotes/origin/revert-7409-daterangecontrol
remotes/origin/stock_reports
remotes/origin/v4.x.x
remotes/origin/v5.x.x
remotes/origin/v6.x.x
remotes/origin/v7.0.x
remotes/upstream/coverage-badge
remotes/upstream/develop
remotes/upstream/hotfix
remotes/upstream/intellisense-fix
remotes/upstream/master
remotes/upstream/python3-super-fix
remotes/upstream/staging
remotes/upstream/staging-fixes
remotes/upstream/v4.x.x
remotes/upstream/v5.x.x
remotes/upstream/v6.x.x
remotes/upstream/v7.0.x
remotes/upstream/v7.x.x
remotes/upstream/v8.x.x
remotes/upstream/v9.x.x
remotes/upstream/validate-fy-dates-1
frappe@ubuntu:~/frappe-bench/apps/erpnext$
To switch frappe I only had to do this:
frappe@ubuntu:~/frappe-bench/apps/frappe$ git checkout staging
M frappe/init.py
Branch staging set up to track remote branch staging from upstream.
Switched to a new branch ‘staging’
frappe@ubuntu:~/frappe-bench/apps/frappe$ git branch -a
develop
master
* staging
remotes/upstream/HEAD → upstream/develop
remotes/upstream/adityahase-coverage-badge
remotes/upstream/allow_quick_entry_fields
remotes/upstream/auto-repeat-schedule
remotes/upstream/codingCoffee-patch-1
remotes/upstream/coverage-unexecuted-fix
remotes/upstream/develop
remotes/upstream/frappe-chat
remotes/upstream/hof
remotes/upstream/hotfix
remotes/upstream/issue_result
remotes/upstream/kickbot
remotes/upstream/mac-address-restrict
remotes/upstream/manassolanki-patch-1
remotes/upstream/master
remotes/upstream/post-list-view
remotes/upstream/raghukamath-patch-1
remotes/upstream/revert-4133-grid
remotes/upstream/revert-4685-hotfix-xss-v10
remotes/upstream/revert-5486-hotfix
remotes/upstream/revert-5556-apply-user-permission-to-treeview
remotes/upstream/revert-5767-modules-dropdown
remotes/upstream/revert-5872-update_billing_details
remotes/upstream/staging
remotes/upstream/staging-fixes
remotes/upstream/trim_tables-docstring
remotes/upstream/v4.x.x
remotes/upstream/v5.x.x
remotes/upstream/v6.x.x
remotes/upstream/v7.0.x
remotes/upstream/v7.x.x
remotes/upstream/v8.x.x
remotes/upstream/v9.x.x