What is the key difference between a ‘git rebase’ and ‘git merge’
Answer»
‘git MERGE’ takes the unique commits from the two BRANCHES, merge them together and CREATE another commit with the merged changes; whereas in a ‘git rebase’ the work on the current branch is replayed and placed at the tip of the other branch resulting in re-writing the commit objects.
‘git rebase’ is applied from the branch to be rebased, whereas ‘git merge’ is applied on the branch that needs to merge the feature branch.
‘git merge’ preserves the history and makes it easier to track the ownership or when a code was broken in the project history; UNLIKE ‘git rebase’ which changes the commit history by changing the commit objects (SHA-1) ids.
‘git rebase’ is often used locally for feature and quickfix and bug fix branches; however ‘git merge’ are used for long running STABLE branches.