ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 105 - DEA-C01 discussion

Report
Export

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?

A.

git diff branchB master git commit -m <message>

Answers
A.

git diff branchB master git commit -m <message>

B.

git pull master

Answers
B.

git pull master

C.

git rebase master

Answers
C.

git rebase master

D.

git fetch -b master

Answers
D.

git fetch -b master

Suggested answer: C

Explanation:

To ensure that Branch B is up to date with the latest changes in the master branch before submitting a pull request, the correct approach is to perform a git rebase. This command rewrites the commit history so that Branch B will be based on the latest changes in the master branch.

git rebase master:

This command moves the commits of Branch B to be based on top of the latest state of the master branch. It allows the developer to resolve any conflicts and create a clean history.

Alternatives Considered:

A (git diff): This will only show differences between Branch B and master but won't resolve conflicts or bring Branch B up to date.

B (git pull master): Pulling the master branch directly does not offer the same clean history management as rebase.

D (git fetch -b): This is an incorrect command.

Git Rebase Best Practices

asked 29/10/2024
Anupam Roy
45 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first