rebase
Rebaserewrites all the commits of afeature branchand makes itlinear- Modifies the timestamp
- Rebasing is a
destructive operationthat changes history - Rebase the feature branch
- Merge feature branch into master
- Rebase is a way to
condenseall commits of a feature branch and the latest changes in master intoone commitand merge itfast-forwardto master - When rebasing, all commits in feature branch are pointed to the last master commit

## Step 1: rebase
git checkout feature # checkout feature branch
git rebase master # rebase feature branch on top of base branch
## Step 2: Merge
git checkout master # checkout base branch
git merge feature # merge feature branch into base branch (FF will be used)
-
Step 1
-
Git creates a copy of the feature commits at the end of the master branch (last commits)
-
The old feature commits will be garbage collected because there are no pointers to them
-
Step 2
-
Merge with FF
Rebase with squash
- All the commits are collapsed into
one commitcontaining all the changes in the squashed commits - Before squashing, the feature branch is also
rebasedso thatfast-forwardtechnique can be applied to merge into base branch