What is the difference between "git merge" and "git rebase"?

  • Both commands have the same effect
  • Merging preserves the commit history, while rebasing rewrites it
  • Merging rewrites the commit history, while rebasing preserves it
  • None of the above
The key difference is that "git merge" preserves the commit history by creating a new merge commit, while "git rebase" rewrites the commit history by applying the changes of one branch onto another. Rebase creates a linear, cleaner history but should be used with caution in shared branches.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *