A Git a day : Merge vs rebase


Merge combines commit from say a master branch into a feature branch while retaining history from both branch.


Rebase places new changes on top of a master branch. While the picture looks fine, all changes from feature branch are sync with master's commits. If this is the other way around, rebasing master in feature branch, then master commits will be lost.

So the golden rule of using rebase is :-

Is anyone looking / using this branch before we do our rebasing. We don't want to change history for master and confuse developers.

If you want to use rebase, create a feature branch.




Interactive rebasing - here you get to choose which histories you want to be included in the commit.

Comments

Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

A quick tutorial for OWASP ZAP tool for beginners