exam questions

Exam AZ-400 All Questions

View all questions & answers for the AZ-400 exam

Exam AZ-400 topic 7 question 62 discussion

Actual exam question from Microsoft's AZ-400
Question #: 62
Topic #: 7
[All AZ-400 Questions]

You are developing an application. The application source has multiple branches.
You make several changes to a branch used for experimentation.
You need to update the main branch to capture the changes made to the experimentation branch and override the history of the Git repository.
Which Git option should you use?

  • A. Rebase
  • B. Fetch
  • C. Merge
  • D. Push
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
motu
Highly Voted 4 years, 2 months ago
Shouldn't it be a rebase since we want to "override the history of the Git repository"? A merge will not override the history, merely add the new changes,
upvoted 53 times
TechieBloke
4 years, 2 months ago
The merge will result as a combination of commits, whereas rebase will add all the changes in feature branch starting from the last commit of the master branch... so rebease never overwrites anything. Here Merge should be correct. https://www.atlassian.com/git/tutorials/merging-vs-rebasing
upvoted 13 times
mfela
4 years, 2 months ago
From the link that you provided: "But, instead of using a merge commit, rebasing re-writes the project history by creating brand new commits for each commit in the original branch." I would say A "rebase"
upvoted 13 times
Morke
3 years, 10 months ago
as mfela states, merge doesn't overwrite, but rebase does.
upvoted 2 times
...
...
haxaffe
3 years, 7 months ago
You can rewrite the entire history with rebase. https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase It's not mentoined in the answer but interactive rebase is a parameter for rebase and can do exactly what is asked.
upvoted 1 times
...
mpindado
3 years, 5 months ago
A simple rebase will still overwrite changes on master if master has changes since feature was created.
upvoted 1 times
...
...
...
Corona_Virus
Highly Voted 4 years, 2 months ago
Correct Answer is A "Rebase"
upvoted 27 times
Pino2012
3 years, 9 months ago
Corona Virus is right
upvoted 17 times
LeeVee
3 years, 7 months ago
lol atleast theres a right with corona virus
upvoted 16 times
...
...
...
Thameur01
Most Recent 1 week, 4 days ago
Selected Answer: A
should be Rebase then Merge
upvoted 1 times
...
Dankho
4 months, 3 weeks ago
Selected Answer: A
Going with A but it's not enough. This is the correct answer if we interpret the question as asking what starts the process of overriding the history. While rebase alone doesn't update the remote main branch, it sets up the rewritten history, which is a prerequisite for overriding the repository's history. To finalize the update, you would need to: 1 - Switch to the main branch. 2 - Apply the rebased changes, typically with a fast-forward or force-push. Why not Merge: Merge combines changes from two branches but does not rewrite or replace history; it creates a merge commit instead.
upvoted 1 times
...
FeriAZ
8 months, 1 week ago
Selected Answer: A
Overriding History: Rebasing allows you to rewrite the commit history of your branch. You can replay the commits from the experimentation branch on top of the latest commit of the main branch, effectively integrating the changes while discarding the original history of the experimentation branch.
upvoted 1 times
...
SenseiJC
1 year, 2 months ago
Selected Answer: A
I think it is "A. Rebase" because a merge preserves the history on the branch (assuming commits on master and experiment happened in parallel). Only Rebase will do as the question requests and "override the history" because it forces the merged branch to offer its commits AFTER the head of the main branch.
upvoted 1 times
...
xRiot007
1 year, 3 months ago
Rebase will override history. Please do not use this on commercial projects.
upvoted 2 times
...
Rams_84zO6n
1 year, 8 months ago
Selected Answer: C
Given answer is correct 100%. Rebasing is the process of moving or combining a sequence of commits to a new base commit. Since you created your branch, main branch has moved, so you can rebase your branch to latest commit of main branch. This doesn't do ANYTHING to the main branch. To get changes to main branch from your feature branch, YOU HAVE TO DO A MERGE
upvoted 1 times
...
rahul51it
1 year, 9 months ago
Please update it to A.
upvoted 2 times
Rams_84zO6n
1 year, 8 months ago
I think the given answer is correct. Rebase makes sense if you are updating feature branch with latest commit of main branch. This will make you merge to main branch easy later. But the question asked is How to get the changes from branch to main
upvoted 1 times
...
...
dottLorenz
1 year, 9 months ago
Rebase the master branch to the feature and override the other commit present in the master after the fork of feature So rebase is the response
upvoted 1 times
...
icedog
1 year, 10 months ago
Selected Answer: A
A. Rebase to squash all the commits in the main branch Merge will add the commit history from the feature branch onto of the main branch
upvoted 2 times
...
syu31svc
2 years, 3 months ago
Selected Answer: A
https://docs.microsoft.com/en-us/azure/devops/repos/git/rebase?view=azure-devops&tabs=visual-studio-2019 "Git rebase resequences the commit history of the target branch so that it contains all source branch commits, followed by all target branch commits since the last common commit. Another way to view it is that a rebase replays the changes in your target branch on top of the source branch history" Answer is A
upvoted 1 times
...
mclovin
2 years, 4 months ago
Selected Answer: A
if it's overriding, then answer is Rebase
upvoted 1 times
...
Eltooth
2 years, 6 months ago
Selected Answer: A
A is correct answer.
upvoted 1 times
...
rdemontis
2 years, 7 months ago
Selected Answer: A
since yuou need to rewrite the main history you need to use a rebase. The only way to ensure to write all experimentation history in the main branch https://www.atlassian.com/git/tutorials/merging-vs-rebasing
upvoted 3 times
...
lugospod
2 years, 9 months ago
Got this January 2022. Rebase. 100% on that part.
upvoted 6 times
...
Art3
2 years, 10 months ago
Rebase, naturally.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...