Describe a production-quality Git and GitHub workflow for a .NET development team.
Quick Interview Answer
Detailed Explanation
Keep the primary branch protected and deployable. Developers synchronize with the remote, create short-lived branches for focused changes, make clear commits, and push those branches to GitHub. Changes enter the primary branch through pull requests rather than direct unreviewed pushes.
Pull requests should explain the purpose of the change and run CI that restores dependencies, builds the solution, executes automated tests, and performs any required quality or security checks. Repository rules can require successful checks, reviews, and code-owner approval for sensitive areas.
Secrets belong in secure configuration rather than Git history. Releases should be traceable to commits and, where appropriate, version tags. Deployment workflows should use least-privilege permissions, protected environments, and auditable automation.
The team should also have documented approaches for urgent hotfixes, rollback, dependency updates, branch cleanup, conflict resolution, and accidental credential exposure. The objective is not a complicated Git history; it is a workflow that makes changes reviewable, reproducible, secure, and safe to deploy.
Code Example
# Typical developer flow
git switch main
git pull --ff-only
git switch -c feature/interview-improvement
# edit files
git status
git diff
git add .
git commit -m "Improve interview question page"
git push -u origin feature/interview-improvement
# GitHub:
# 1. Open pull request
# 2. Run required CI checks
# 3. Complete review
# 4. Merge using repository policy
# 5. Deploy through protected automation