Skip to main content

Usual Command Flows - Daily

This flow represents a typical consultant's daily routine for working with Salesforce scratch orgs and version control.

1. Start of Day - Setup

Bash
# Open your terminal/CLI
# Navigate to your project folder
cd path/to/your/salesforce-project

# Get latest changes from repository
git pull origin main

Check for conflicts: If conflicts occur, resolve them before proceeding or escalate to Technical Architect.

2. Salesforce CLI Authentication

Bash
# Login to your scratch org
sf org login web --alias my-scratch-org

# Or use existing auth
sf org open --alias my-scratch-org

3. Deploy Latest Team Changes

Bash
# Deploy teammates' latest changes to your scratch org
sf project deploy start --target-org my-scratch-org

Review deployed metadata output
Check for any overlaps with your planned work

4. Handle Potential Overlaps

If deployed metadata overlaps with your work:

Bash
# Check what changed in git
git log --oneline -n 10
git diff HEAD~1 path/to/file

# If needed, revert specific files to previous version
git checkout HEAD~1 path/to/file

6. Daily Development Work

Just work in Salesforce
Ideally retrieve once per ticket change (see below)

7. End of Day - Retrieve Changes

Bash
# Retrieve metadata changes from your scratch org
sf project retrieve start --target-org my-scratch-org

# Alternative: Retrieve specific metadata types
sf project retrieve start --metadata ApexClass,CustomObject --target-org my-scratch-org

8. Verify and Commit Changes

Bash
# Check retrieved changes
git status
git diff

# Stage specific files (selective commit)
git add force-app/main/default/classes/MyClass.cls
git add force-app/main/default/objects/MyObject__c/

# Commit with ticket number
git commit -m "TICKET-123: Add new validation rule to Account object"

# Push to remote repository
git push origin feature/my-ticket-branch

9. Handle Merge Conflicts

If merge conflicts occur:

Bash
# Attempt to resolve locally
git pull origin main
# Resolve conflicts in your IDE
git add .
git commit -m "TICKET-123: Resolve merge conflicts"
git push

If unable to resolve: Escalate to Technical Architect or CoE Hub.