#The branches are like this
A---B---C topic
/
D---E---F---G main
#git rebase <base> <target>
git rebase master topic
#<target> get moved forward on <base>
#NOTE: commits on <target> change their hash
A°--B°--C° topic
/
D---E---F---G main
git rebase -i HEAD
the rebase command integrates changes from one branch into
another. It is an alternative to the better known "merge"
command. Most visibly, rebase differs from merge by rewriting
the commit history in order to produce a straight,
linear succession of commits.
git checkout -b child
git commit
git checkout master
git commit
git checkout child
git rebase master
Generally, it is an alternative of git merge command. Merge is always a forward changing record. Comparatively, rebase is a compelling history rewriting tool in git. It merges the different commits one by one.
$ git rebase --onto master server client
git rebase <basebranch> <topicbranch>
git rebase -i --root
git rebase -i HEAD~3
git rebase -i -branch
# opens interactive rebase interface (more instructions needed
# to work with rebase) -i HEAD~3 #this is selecting 3x commits
# from the head (can change based on rebase)
# To, e.g, update my feature-branch with new master's commits:
git checkout master
# My master --> into --> my feature
git rebase my-feature