I have 2 branches X and Y. X is parent of Y.
X have some feature-branches rebased into it for e.g X-F1, X-F2..
Y also have some feature-branches rebased into it.for e.g Y-F1, Y-F2..
All the feature-branches commits have been squashed on both X and Y branches
Now I want to rebase X onto Y
so i write command git rebase X
while I am on branch Y
The issue is some changes from branch X are not coming after rebasing
I can see all the changes when I am on branch X but as you know after rebasing they are missing.
Now I want to rebase X onto Y
so i write command
git rebase X
while I am on branch Y
That will rebase Y onto X.
Let's investigate:
I have 2 branches X and Y. X is parent of Y.
Branches do not have parents, commits do. I assuming you meant "branch Y was branched off branch X at some point"
X have some feature-branches rebased into it for e.g X-F1, X-F2..
Y also have some feature-branches rebased into it.for e.g Y-F1, Y-F2..
All the feature-branches commits have been squashed on both X and Y branches
According to your description, your history graph could look something like this:
x1-x2-xf1-x3-xf2-x4-x5 < X
\
y1-y2-yf1-y3-yf2 < Y
Now, running git checkout Y && git rebase X
(which can be done with a single command: git rebase X Y
), will produce the following history:
x1-x2-xf1-x3-xf2-x4-x5 < X
\
y1'-y2'-yf1'-y3'-yf2' < Y
But you claimed
Now I want to rebase X onto Y
Which should be git rebase Y X
(or the longer git checkout X && git rebase Y
), resulting in the history:
x1-x2-xf1-x3 < X
\
y1-y2-yf1-y3-yf2-xf2'-x4'-x5' < Y
Rebase will automatically drop commits which it detects as being already applied or which would result in an empty change set.