Suppose there are 2 branches: master and feature
- git checkout feature
- git rebase feature -i
This will open editor in interactive mode. DIfferent options like pick and squash are available
First use rebase command standing in the feature branch.
- git checkout feature
- git rebase master
This will create a linear history, moving all the commits from Feature to current Head of master
Now go to master and merge:
- git checkout master
- git merge Feature
- git checkout feature
- git rebase master -i
- git checkout master
- git merge feature
- git checkout master
- git merge feature This will create a non-linear history if master and feature have deviated with non-linearity.
- git checkout --