GH-900 practice question 14 of 15

In GitHub, why is it recommended to deploy from your feature branch before merging into the main branch?

Full set: 144 questions
Answer options
A: To directly deploy changes from the main branch without any intermediate testing
B: To speed up the process of merging changes into the main branch
C: To avoid the need for testing changes in production
D: To ensure the changes are verified and validated in a production environment Correct answer
Correct Answer:
D. To ensure the changes are verified and validated in a production environment
Explanation

Deploying from a feature branch to a staging or temporary production environment is a crucial step in modern CI/CD workflows, often referred to as creating a "preview environment." This practice allows developers, QA teams, and other stakeholders to verify and validate the proposed changes in a live, production-like setting. It ensures the new feature works as intended and does not introduce regressions or performance issues before the code is merged into the main branch. This pre-merge validation significantly reduces the risk of introducing bugs into the primary codebase, thereby maintaining the stability and integrity of the main branch.

Why Incorrect

A. This is incorrect because the purpose is to add an essential intermediate testing and verification step, not to eliminate it.
B. This is incorrect as this practice prioritizes quality and stability over the raw speed of merging by adding a validation step.
C. This is incorrect because this process is a form of controlled testing in a production or production-like environment, not a way to avoid it.

References

1. Official Vendor Documentation (GitHub): In the documentation for GitHub Actions

the concept of deploying to specific environments is detailed. It states

"Environments are used to describe a general deployment target like production

staging

or development... You can configure environments with protection rules and secrets. When a workflow job deploys to an environment

the job can't access secrets that are defined in other environments." This structure is designed to facilitate safe

pre-merge deployments from feature branches to non-production environments for verification.

Source: GitHub Docs

"Using environments for deployment

" Section: "About environments."

2. Official Vendor Documentation (GitHub): The GitHub Flow guide

a recommended workflow

implicitly supports this practice. The flow involves creating a branch

adding commits

opening a pull request

discussing and reviewing code

and then deploying for final verification before merging. This ensures that only production-ready code is merged into the main branch.

Source: GitHub Guides

"GitHub flow."

3. University Courseware (MIT): MIT's Software Construction course emphasizes the importance of automated testing and regression testing as part of the development cycle. Deploying a feature branch to a test environment is an advanced form of this principle

extending automated checks to a live system to validate functionality and integration before merging

which is a core tenet of robust software engineering.

Source: MIT OpenCourseWare

6.031: Software Construction

Spring 2016. Lecture 20: "Testing."

Scroll to Top