Your repository has multiple branches. You make several changes on an experimental branch and need to update the main branch to include those changes while overriding the repository history. Which Git operation should you use?
Choose an answer
Tap an option to check your answer.
Correct answer: Rebase.
Why this is the answer
Rebase is the correct operation because it integrates changes from one branch onto another by moving or combining a sequence of commits to a new base commit. This effectively rewrites the commit history, making it appear as if the changes were made directly on the target branch. Fetch downloads commits, files, and refs from a remote repository into your local repository but does not integrate them. Merge integrates changes from one branch into another by creating a new merge commit, preserving the original history of both branches, which is not the goal here. Push uploads local branch commits to a remote repository.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed