02 Quiz: Feature Branch Development
Instructions
- Some questions include Git graphs in the style of the VS Code Git Graph visualizer — study them carefully before answering.
- Each question has 4 options with exactly one correct answer.
- You can retry incorrect answers; immediate feedback explains the reasoning.
Graph legend:
You’ve just edited main.py to fix some PEP8 violations. What state is this file in before you run git add?
Your teammate asks why Git has a staging area instead of just committing changes directly from the working directory. What is the BEST explanation?
In the graph below, main keeps moving forward with stable commits while experimental work happens on feature (including WIP commits).
What is the PRIMARY purpose of this separation into a feature branch instead of working directly on main?
Locally, your repository looks like this — feature has three commits that are not yet on GitHub:
You run git push -u origin feature for the first time. What is the resulting state?
You’ve fixed multiple PEP8 violations in a file: import problems, spacing issues, and naming conventions. What is the BEST commit strategy?
What is the PRIMARY purpose of a Pull Request (PR)?
Your Pull Request was just approved and merged into main. The graph now looks like this:
What should you do with the feature branch now?
You run git status and see a file listed under both ‘Changes to be committed’ AND ‘Changes not staged for commit’. What does this mean?
Your team has enabled branch protection on main. You try to push directly to main and get an error. What is happening?
You’ve been working on a large feature that touches 15 files and changes over 2000 lines. What is the BEST approach for your Pull Request?
Which commit message follows best practices for professional development?
You’re starting work on a new feature. Locally, you see the following state — your local main is outdated, the team has pushed two commits to origin/main in the meantime:
What is the correct first step before you start coding?
During code review of your Pull Request, a teammate suggests adding type hints to your functions. What is the BEST response?
You’ve opened a Pull Request (commit “PR open”). Your teammate requests changes. You respond with two more commits (“review fix” and “type hints”) and push them to the same feature branch:
What happens to the PR?
What is the fundamental principle behind the feature branch workflow?
While you were working on your feature, a teammate merged their PR — so main has moved forward. The graph now looks like this:
Which statement about this state is correct?