What are the differences to use git merge and git rebase commands and their execution model?
Git Merge
This creates a new commit 'G' in the main branch. G ties the histories of both main and feature branches.
Git merge is nondestructive in nature i.e. neither the main nor the feature branch is changed.
Git Rebase
It moves the feature branch histories to the head of the main branch. It creates new commits E, F and G for each commit in the feature branch.
The benefit of rebase is that it has linear commit history. Rebase can be dangerous if the golden rule of git rebase is not followed.
ByteByteGo clearly describes the details in the given diagram
No comments:
Post a Comment