Home › Interview Questions › Github, Devops, Devops

How do you move code from lower environments to higher environments (dev, staging, prod) in GitHub? What practices do you follow to maintain code across environments?

🟡 Medium Conceptual Junior level
1 Times asked
Mar 2026 Last seen
Mar 2026 First seen

💡 Model Answer

A common practice is to use a Git branching model such as GitFlow or trunk-based development. Feature work happens in feature branches that merge into a develop branch. The develop branch represents the next release and is continuously integrated. When the code is ready for staging, a release branch is created from develop and deployed to a staging environment via a CI pipeline (e.g., GitHub Actions). After testing, the release branch is merged into main (or master) and deployed to production. Each environment has its own configuration files or environment variables, and the CI pipeline injects the correct values during deployment. Automated tests run at each stage: unit tests on every commit, integration tests on develop, and end‑to‑end tests on staging. Using infrastructure-as-code (Terraform, CloudFormation) ensures that the environments are reproducible. Finally, version tags on Git commits provide a clear audit trail of what code ran in each environment.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500