Push branch with pre-director to github

Let's say from my original master, I made some changes to it and committed the change in a moment t1

. Then I pushed it to github (naming it branchA

). Then I made some other changes and committed it in a moment t2

. I don't want to push this to branchA

, but I want to push it to another branch named branchB

.

Is it possible to enumerate branchA

as a precondition for branchB

diff to branchB

NOT include the changes made by prio in t1

, in other words, diff in branchB

should only show the difference between branchA

and branchB

?

Bazaar/Launchpad

offers this option, but I was unable to find a similar feature in Github

. (I'm new to git

, so maybe this isn't what they are doing at Github

?)

+3


source to share


1 answer


This means that you have:

Local Repo                  Upstream (GitHub Repo)

 .--.--o--x--y branchA   <====> o--o--x branchA
(master)

      

But you want:



.--.--o--x branchA      <====> o--o--x branchA
(mast) \
        y branchB        => you can push now

      

This means that you need to first reinstall on o

whatever came after x

( t1

) to build locally branchB

before pushing it to your fork.

git checkout branchA                
git branch branchB                  # creates branchB where branchA currently is
git reset --hard origin/branchA     # reset branchA to x
git rebase --onto master x branchB  

      

+1


source







All Articles