Git Merge VS Git Rebase

Which is better merge or rebase?

Merging is a safe option that preserves the entire history of your repository, while rebasing creates a linear history by moving your feature branch onto the tip of main.

Should I use git rebase or git merge?

In which situations should we use a rebase ? Use rebase whenever you want to add changes of a base branch back to a branched out branch. Typically, you do this in feature branches whenever there's a change in the main branch.

Why you should never rebase in git?

Rebasing can be dangerous! Rewriting history of shared branches is prone to team work breakage. This can be mitigated by doing the rebase/squash on a copy of the feature branch, but rebase carries the implication that competence and carefulness must be employed

Other sources

Read more article

Watch Youtube video