Two developers branched from the GitHub repository's master branch, creating Branch A and Branch B. The Branch A developer already deployed to production; Branch B will be merged into master in next week's release. Before opening a pull request into master, which Git command should the Branch B developer run?
Choose an answer
Tap an option to check your answer.
Correct answer: git rebase master.
Why this is the answer
The git rebase master command is the best choice for the Branch B developer. Rebasing rewrites the commit history of Branch B, applying its changes on top of the latest master branch commits. This creates a clean, linear history, making the subsequent merge into master a fast-forward merge, which is generally preferred for its simplicity and readability. git diff branchB master git commit -m is incorrect because git diff only shows differences and git commit -m creates a new commit, neither of which integrates changes from master into Branch B. git pull master would merge master into Branch B, creating a merge commit in Branch B's history, which is less clean than rebasing. git fetch -b master only downloads the master branch's changes without integrating them into Branch B.
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