1.2 Git Basics: Merge and Rebase
In this lesson, I’ll show you how to integrate source code changes from one branch to another using either
git merge or
git rebase. There are some subtle differences between them—for instance, merging preserves the branch history, while rebasing doesn’t. Follow along and I’ll explain when to use one or the other.
The following snippet will rebase the contents of the branch
branch to master, without adding an extra commit message for the merge.
git checkout branch git rebase master git checkout master git merge branch