DEA-C01 · Question #148
Two developers are working on separate application releases. The developers have created feature branches named Branch A and Branch B by using a GitHub repository's master branch as the source. The…
The correct answer is C. git rebase master. After Branch A's code was deployed and merged into master, Branch B is now behind master. Before raising a pull request, the developer for Branch B should run 'git rebase master' to replay Branch B's commits on top of the current master (which now includes Branch A's changes)…
Question
Two developers are working on separate application releases. The developers have created feature branches named Branch A and Branch B by using a GitHub repository's master branch as the source. The developer for Branch A deployed code to the production system. The code for Branch B will merge into a master branch in the following week's scheduled application release. Which command should the developer for Branch B run before the developer raises a pull request to the master branch?
Options
- Agit diff branchB master
- Bgit pull master
- Cgit rebase master
- Dgit fetch -b master
How the community answered
(31 responses)- A3% (1)
- B13% (4)
- C81% (25)
- D3% (1)
Explanation
After Branch A's code was deployed and merged into master, Branch B is now behind master. Before raising a pull request, the developer for Branch B should run 'git rebase master' to replay Branch B's commits on top of the current master (which now includes Branch A's changes). This ensures the PR has no divergence from master and results in a clean, linear commit history. 'git diff branchB master' (A) only shows differences but makes no changes. 'git pull master' (B) would merge master into Branch B, which works but creates an extra merge commit and is considered less clean than rebasing before a PR. 'git fetch -b master' (D) is not valid git syntax.
Topics
Community Discussion
No community discussion yet for this question.