200-901 exam dumps

200-901 practice question 19 of 204

Cisco DevNet Associate. Associate level, Cisco. Free question with the correct answer and a full explanation.

200-901 Question 19

Single answer

You are working on a feature branch in a Git repository and want to integrate the latest changes from the main branch into your feature branch. Which command(s) should you use to achieve this while preserving the commit history of both branches?

  1. A

    git merge main

  2. B

    git rebase main

  3. C

    git checkout main

  4. D

    git commit -m 'Merge main into feature'

Show answer and explanation

Correct answer: A

Explanation

To integrate changes from the main branch into a feature branch while preserving the commit history of both branches, the 'git merge main' command is used. This command performs a three-way merge, combining the histories of both branches without rewriting their commits. Other options, such as 'git rebase main,' rewrite the commit history and may not be suitable depending on the workflow requirements, while the other commands do not achieve the desired integration.

  • A. Correct.

    This is the correct command to merge the main branch into your current feature branch, preserving the commit history of both branches.

  • B. Incorrect.

    While this command can integrate changes from the main branch, it rewrites the commit history by applying commits from the feature branch on top of the main branch, which does not preserve the original commit order.

  • C. Incorrect.

    This command switches to the main branch, but it does not integrate changes into your feature branch.

  • D. Incorrect.

    This is not a valid Git command for merging or rebasing branches. It is used to create a new commit with a specified message.

Timed practice exam

Take a 200-901 practice test under exam conditions

75 questions in 120 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam