A developer wants Copilot CLI to help prepare a change locally, create a branch, and open a pull request with GitHub CLI. The terminal is currently in a cloned repository, but the working tree already contains uncommitted edits from another task. What should the developer do first? Select one answer.
cd ~/work/payment-service
git status --short
M src/billing/discounts.ts
?? notes/debug-output.txt
copilot
# Prompt:
# Create a branch for issue #92, update the failing tests,
# commit the changes, push the branch, and open a pull request.Choose an answer
Tap an option to check your answer.
Correct answer: Clean or isolate unrelated changes before execution.
Why this is the answer
The correct answer is to clean or isolate unrelated changes before execution. Copilot CLI, like other Git operations, works best with a clean working directory. The git status --short output shows uncommitted modifications (M src/billing/discounts.ts) and untracked files (?? notes/debug-output.txt). If Copilot were to proceed, these unrelated changes would likely be included in the new branch and commit, polluting the intended task for issue 92. Cleaning the working tree (e.g., using git stash for the modified file and git clean for untracked files) ensures that Copilot focuses only on the changes relevant to the specified prompt. Letting Copilot include all working-tree changes would lead to an incorrect or messy commit. Running gh pr create before reviewing the diff is premature and doesn't address the uncommitted changes. Switching directly to the repository's default branch would discard the current uncommitted changes or require a stash, which is essentially a form of isolating changes.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed