Merge Feature Branches and Deploy Metadata
Now that Chan and Maria are done developing their features, it’s time to merge their code and do some integration testing. In this step you use GitHub pull requests to review and merge Chan’s and Maria’s individual feature branches in source control then deploy the updated app to the Dev Hub org.
At the end of this step, your Property record page should look like this:
Merge Map Feature Branch
The DreamHouse Realty brokers love the new map feature and being able to see at a glance what’s near the properties. Let’s merge Chan’s map component into the main codeline on the master branch.
- Go to https://github.com/YOUR_GITHUB_USERNAME/sfdx-project, replacing
YOUR_GITHUB_USERNAMEwith your actual GitHub username.
- Click Compare & pull request next to the feature-chan-map branch (you may also click the Pull requests tab, and then click pull request for the feature-chan-map branch).
Click Create pull request, Merge pull request, then Confirm merge. You should see a message like: Pull request successfully merged and closed.
Merge Gallery Feature Branch
The DreamHouse Realty brokers are really excited about the new picture gallery feature because they and their clients can review the properties before deciding to schedule a visit. Let’s merge Maria’s map component into the main codeline on the master branch.
- Repeat steps 1–4 above, using the feature-maria-gallery branch this time.
Pull Merged Files from GitHub
After merging the pull requests, GitHub’s copy of the sfdx-project repository is the only copy with both Chan’s and Maria’s new features. Use Git to pull the updates from GitHub to your local project so that you can deploy the metadata to your next Salesforce environment.
- In your sfdx-maria working directory, switch to the Git branch named master.
git checkout masterYou should see output like
Switched to branch 'master'.
- Pull remote commits from the master branch on GitHub.
git pull origin master
- Verify that your local project now contains both Chan’s and Maria’s features. You should see three folders in the sfdx-maria/force-app/main/default/aura directory:
Run Tests to Validate Changes
In practice, now that the feature branches have been merged, a good next step is to deploy the integrated changes to a sandbox for functional and user-acceptance testing. However, in the interest of time and not making you perform repetitive tasks, let’s skip ahead to deploying straight to your Dev Hub org.
Deploy Metadata to Dev Hub Org
Your work is almost done at this point. Next, deploy the updates and explore the app. To deploy metadata to non-scratch orgs, we use the Salesforce CLI command
force:source:deploy rather than
force:source:push that we used earlier in the project.
- Deploy local source metadata to Dev Hub org.
sfdx force:source:deploy --targetusername DevHub --sourcepath force-app
- Explore the updated app in the Dev Hub org.
sfdx force:org:open --targetusername DevHub
- Click to open the App Launcher, then click DreamHouse.
- Click Properties then click the property name of any record in the list. If you do not see any property records, try changing the selected list view.
That’s it, you’re done! You just developed, tested, and deployed new updates to an existing application by following a source-centric and collaborative development model using Salesforce DX, Git, and GitHub. Keep up the momentum and explore the Package Development Model module to learn how to manage and release app changes using unlocked packages and explore the Continuous Integration Using Salesforce DX module to learn how to set up CI/CD processes.
Click Verify Step to confirm Chan’s and Maria’s updates to the Property record page were deployed to your hands-on org and to collect your badge.