0 votes
in Technology by (54.6k points)

What is the difference between Git Merge and Git Rebase?

1 Answer

0 votes
by (54.6k points)
Suppose you are working on a new feature in a dedicated branch, and another team member updates the master branch with new commits. You can use these two functions:

Git Merge

To incorporate the new commits into your feature branch, use Git merge.

Creates an extra merge commit every time you need to incorporate changes

But, it pollutes your feature branch history

Git Merge

Git Rebase

As an alternative to merging, you can rebase the feature branch on to master.

Incorporates all the new commits in the master branch

It creates new commits for every commit in the original branch and rewrites project history