Reputation: 133
Silly question, but i need help.
There are two branches in the same repository in git-hub. A and B.I have cloned the branch A, i made some changes and now I want to push the changes to branch B.With 'git status' i can see that my branch is up-to-date with 'origin/A'. Should i add and commit the changes and then just 'push' to 'origin/B'?
What can I do to push the changes to the correct branch(B) and not A?I don't want to replace anything in the A branch.
Upvotes: 2
Views: 3047
Reputation: 113485
This should work:
switch on branch B
:
git checkout B
merge A
in B
git merge A
push the changes
git push origin B
Upvotes: 5
Reputation: 580
You just need to do git push origin frombranch:tobranch
EDIT after looking at your clarifying comments:
git checkout branch-b;
git merge branch-a
assuming you have origin\branch-a
and is updated.
Upvotes: 4
Reputation: 1135
If A is up to date, and is your origin, checkout branch B and just do git merge origin and B will be updated with all A's latest changes. If you want to check first before merging origin (A), do git fetch origin then do git log -p HEAD..origin to see the changes you are going to merge.
Upvotes: 0