DEVASC Exam QuestionsBrowse all questions from this exam

DEVASC Exam - Question 505


A developer is working on a branch called topic that was created from the master branch to add a new feature to the product. After making a few commits on the branch, the developer wants to compare the changes between the topic and the master branches. Which two Git commands are used? (Choose two.)

Show Answer
Correct Answer: BE

To compare changes between two branches in Git, the commands used can be 'git diff topic...master' and 'git diff topic master'. The command 'git diff topic...master' compares the changes between the common ancestor of the two branches (where they initially diverged) and the tip of each branch. The command 'git diff topic master' directly compares the changes between the tips of the topic and master branches.

Discussion

3 comments
Sign in to comment
RonAdamsOptions: BE
Nov 30, 2024

B and E are correct. B. git diff topic...master - This command compares the changes between the common ancestor of the two branches (usually where they diverged) and the tip of each branch. E. git diff topic master - This command compares the changes between the tips of the two branches directly.

peterbuzaOptions: CE
Jun 13, 2024

git diff [<options>] [--merge-base] <commit> [--] [<path>…​] This form is to view the changes you have in your working tree relative to the named <commit>. You can use HEAD to compare it with the latest commit, or a branch name to compare with the tip of a different branch.

daniii89
Feb 6, 2025

HEAD refers to the current branch’s latest commit, so this would compare topic with itself or an unrelated commit.

daniii89Options: BE
Feb 6, 2025

Its BE, correct