Rebasing
Rebasing is a type of merge that makes it look as though our changes were actually made on the main branch rather than on a feature branch.
Once we perform a Rebase we get a new copy of all the commits on our branch but now they are parented to the tip of the target branch. The 'After Rebasing' diagram below shows the original commits but we should be aware that the garbage collector will clean these up when it runs.
Pending Rebase
rebase setup showing branch to be rebased
After Rebasing
rebase setup showing branch to be rebased
There is another difference between performing a rebase and merge and that relates to how the history will look. With a normal merge we'll have a new commit created that has two parents and hence a branch will be showing in the audit trail. With a rebase we get to keep a linear history and the fact another branch was created is lost. See below with standard merge on the left and a rebase on the right.
Standard Merge History (includes Branch)
standard merge history showing branching
Rebase History (Linear)
rebase setup showing branch to be rebased
See the below videos for more details on Rebasing using VisualGit. Then give it a try for yourself