12/15/2017 - 3:50 PM


The way how I do understand git rebase

#How to understand rebase and all it parameters:

basic command:

git rebase -i branch_1 master  << so what does it mean?

#It means that git will performe interactive rebase "-i". Interactive rebase is meant to check the commits
#and tide up the commits history.

#Second parameter which is after -i means that everything what is in branch_1 will by coppied / applied
#to the third parameter (which is master branch in this case) and at the end git will checkout automaticly 
#to this branch.

#Third parameter as I have mentioned before is target branch onto which we want to rebase.


#Rebasing one branch on to another looks the same like an example befor.


// need to do more resaerch about it - I'm not sure right now
# Rebasing from nth branch to the for example master branch.

#example work tree

A--B--F--G master
     C--D--E branch_1
             H--I branch_2

# If we'd like to rebase our branch_2 onto master with a standard rebase command : git rebase -i branch_2 master
# we will find that the changes which were commited in branch_1 will be added to the master as well.
# To avoid that we can sepcify to to git what to omit. 

git rebase -i branch_2 branch_1 master

# I understand this command as everything what was made in branch_2 copy to master but ommit
# everything what was created in branch_1.