switch-to-branch
Switch one or more apps to a specified git branch.Arguments
The git branch name to switch to (e.g., develop, version-14, main)
Space-separated list of app names to switch. If not specified, switches all apps.
Options
Run bench update operations after switching branches
Examples
Switch All Apps to a Branch
develop branch.
Switch Specific Apps
Switch with Upgrade
--upgrade, the command will:
- Switch branches
- Pull latest changes
- Update dependencies
- Run patches
- Build assets
- Restart services
Version Upgrade Workflow
switch-to-develop
Switch frappe and erpnext to the develop branch. This is a convenience command for development work.What It Does
This command:- Switches
frappeto thedevelopbranch - Switches
erpnextto thedevelopbranch - Does not affect other apps
- Does not run upgrade operations
Examples
Development Setup
After Testing on Stable
Branch Naming Conventions
Frappe framework and apps typically use these branch names:Version Branches
Version Branches
version-15- Latest stable version 15version-14- Stable version 14version-13- Older stable version
Development Branches
Development Branches
develop- Active development branchmainormaster- May be used as stable in some apps
Feature Branches
Feature Branches
feature/new-feature- New feature developmentfix/bug-description- Bug fixeshotfix/urgent-fix- Critical fixes
Complete Workflows
Version Migration
Development to Production
Testing Feature Branch
Mixed Branch Setup
Implementation Details
switch-to-branch:bench/commands/update.py:83
The command:
- Validates the branch exists
- Switches each specified app (or all apps) to the branch
- Optionally runs upgrade operations
- Reports any errors during the switch
bench/commands/update.py:96
Hardcoded to switch only frappe and erpnext to develop.
Important Considerations
Branch Compatibility:
All apps should generally be on compatible versions:
- If frappe is on version-15, erpnext should also be on version-15
- Mixing major versions can cause compatibility issues
- Custom apps should match the frappe version
Checking Branch Status
Troubleshooting
Branch Does Not Exist
Branch Does Not Exist
If the branch doesn’t exist:
Uncommitted Changes
Uncommitted Changes
If you have uncommitted changes:
Migration Errors After Switch
Migration Errors After Switch
If migrations fail after switching:
Version Incompatibility
Version Incompatibility
If apps are incompatible:
Comparison with Git Commands
bench switch-to-branch
- Switches multiple apps at once
- Optional upgrade workflow
- Bench-aware operations
git checkout
- Single app at a time
- More control over process
- Standard git workflow
Related Commands
- bench update - Update apps after switching branches
- remote-urls - Check git remote URLs
git branch- List and manage git branchesbench version- Check current version of all apps