Reputation: 1
Below is the current scenario of branch X
& Y
in Git:
A - B [origin/master]
\
C - D - G - H [origin/X]
\
E - F [Y]
where,
developer1 is working on branch X
and
am working on branch Y
.
X
is parent branch of Y
.
Currently branch Y
is pointing remotely to origin/Y
I want to include changes of origin/X
in branch Y
before working further on branch Y
. So, I would like to see, something like:
A - B [origin/master]
\
C - D - G - H [origin/X]
\
E1 - F1 [Y]
1) What are the git commands for rebasing my branch Y
?
2) What does this command(git branch -u origin/X Y
) do?
Upvotes: 8
Views: 18496
Reputation: 30212
It's simple:
git checkout Y
git rebase origin/X
That is, assuming you will do it after someone (the other developer) rebases X (I see it was rebased on top of master).
Second question: it creates a local branch Y that has "upstream" branch set to origin/X. Upstream is like the branch that Y will use as the base when you try commands like git pull
or git pull -r
.
Upvotes: 17