Erfassen Sie Ihre Fortschritte
Trailhead-Startseite
Trailhead-Startseite

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:

Gallery and map components on property record page

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.

  1. Go to https://github.com/YOUR_GITHUB_USERNAME/sfdx-project, replacing YOUR_GITHUB_USERNAME with your actual GitHub username.
  2. Click New pull request.
    “New pull request” button on GitHub project page
  3. Click base: and select master, then click compare: and select feature-chan-map. The pull request should automatically detect and display the differences.
    Selecting branches to create a pull request on GitHub
  4. Click Create pull request, Merge pull request, then Confirm merge. You should see a message like: Pull request successfully merged and closed.

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.

  1. 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.

  1. In your sfdx-maria working directory, switch to the Git branch named master.
    git checkout master
    You should see output like Switched to branch 'master'.
  2. Pull remote commits from the master branch on GitHub.
    git pull origin master
  3. 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:
    • PictureCarousel
    • PictureGalleryCard
    • RecordMap
      Chan’s and Maria’s Aura components in the project

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.

Note

Note

If you want to test the merged code before deploying it to your Dev Hub org, then you can create a new scratch org or sandbox to be your QA environment. As in the previous steps, you’d deploy the code, assign the DreamHouse permission set, and import some sample data.

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.

  1. Deploy local source metadata to Dev Hub org.
    sfdx force:source:deploy --targetusername DevHub --sourcepath force-app
  2. Explore the updated app in the Dev Hub org.
    sfdx force:org:open --targetusername DevHub
  3. Click App Launcher to open the App Launcher, then click DreamHouse.
  4. 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.

Resources