Pagine

Tuesday 23 May 2017

Git - rebase vs merge

The merge command combines the changes from two branches. Instead the rebase command will take the changes from the first branch and apply them to the other branch.

The rebase command can be used if you want to get a feature (commits) from one branch to another and be sure to be close to the tip of the upstream branch. The command applies the changes from the branch called branch to the master branch.

The following examples show the usage of these two commands.

Example of merge:
$ git checkout mybranch
$ git merge master
Example of rebase:
$ git checkout mybranch
$ git rebase master
Note: In the rebase command do not merge commit.

No comments:

Post a Comment