What happens after the merge?

When the Pull Request is merged, the changes from the feature branch become part of the main branch.

In our workflow, main represents the production branch of the project. This is a workflow convention; Git itself does not require a particular branch to be the production branch.

Once the merge is complete, the production deployment process can begin because the configured production branch now contains the new changes.

01Pull RequestFeature changes are reviewed.
02MergeThe feature is merged into main.
03ProductionCloudflare deploys the updated site.

main changes

After the Pull Request is merged, the repository’s main branch contains the newly merged feature.

You can think of the repository at this point as having two important states:

BranchRole
main

Contains the production version and newly merged changes.

feature/*

Contains development work that has already been merged or may be deleted.

Key idea

The merge changes GitHub’s main branch. Cloudflare then uses that change as the source for the production deployment.

Cloudflare detects the commit

Because the Pages project is connected to the GitHub repository, a new commit on the configured production branch can trigger a new production deployment.

Cloudflare receives the updated source and begins the deployment process.

01GitHubA new commit exists on main.
02CloudflareThe connected project receives the change.
03DeploymentCloudflare builds and deploys the project.
Automatic deployment

With Git integration configured, you normally do not need to manually upload the production files after every merge.

Build

Cloudflare runs the build command configured for the Pages project.

For example, a Vite project commonly uses:

npm run build

The build process transforms the source project into the files that will be deployed.

Remember

The build command depends on the project. Always use the command appropriate for your framework or build configuration.

Deployment

If the build succeeds, Cloudflare proceeds with the deployment.

The newly generated version becomes the current production deployment.

01SourceCode comes from the merged main branch.
02BuildCloudflare generates the production output.
03ProductionThe updated website is deployed.
Check the deployment status

If the deployment fails, the production version is not updated by that failed deployment. Check the deployment logs to identify the problem.

Verify production

After the deployment succeeds, open the production website and verify that the merged feature is available.

Do not assume that a successful deployment means every part of the website behaves correctly. Test the actual production site.

CheckWhat to verify
PageThe updated page loads correctly.
NavigationLinks work as expected.
LayoutDesktop and mobile layouts remain correct.
FeatureThe newly merged feature works correctly.
Production verification

Preview testing happens before the merge. Production verification happens after the merge and deployment.

Rollback concepts

Sometimes a new production deployment introduces a problem that was not discovered during preview testing.

There are two different recovery approaches in our workflow: a fast Cloudflare rollback and a GitHub revert.

Option 1: Cloudflare Pages rollback

If production needs to be restored quickly, Cloudflare Pages allows you to roll production back to a previous successful production deployment.

Cloudflare Pages Deployments screen showing the rollback option

Cloudflare Pages provides a rollback action from a previous successful production deployment.

01Open DeploymentsOpen the Deployments section of your Pages project.
02Find a good deploymentChoose a previous successful production deployment.
03Rollback

Open the deployment actions menu and choose the rollback option.

04Verify

Confirm that production is serving the restored version.

Cloudflare rollback

In Cloudflare Pages, go to Deployments, find the previous successful production deployment, open its actions menu, and choose Rollback to this deployment.

Important

A preview deployment is not a rollback target. The rollback target must be a successful production deployment.


Option 2: Revert the Pull Request

A Cloudflare rollback changes which successful deployment is serving production, but it does not undo the change in GitHub’s main branch.

If the problematic change should also be reversed in the Git history, GitHub can create a new Pull Request that reverts the original Pull Request.

GitHub Pull Request showing the Revert option

GitHub can create a new Pull Request that reverses the changes introduced by an earlier merged Pull Request.

01Identify the bad PRFind the Pull Request that introduced the problem.
02Revert

Use GitHub’s Revert action to create a new Pull Request.

03Review

Review and test the reversal like any other Pull Request.

04MergeMerge the revert Pull Request into main.
05DeployCloudflare deploys the updated main branch.
Rollback vs revert

A Cloudflare rollback changes which successful deployment is serving production.

A GitHub revert creates a new change that reverses an earlier Pull Request in the repository.

SituationApproach
Production needs immediate recoveryCloudflare Pages rollback
The problematic change should be reversed in GitHubRevert the Pull Request
The underlying problem needs fixing

Create a new feature/fix branch and follow the normal Pull Request workflow

Recovery is not the final fix

Rollback or revert restores a safer state. After recovery, investigate the original problem and create a proper fix.

Support PageDeploy with a coffee