How to change base branch in git? -
i don't know why question being downvoted, because it's legitimate , common mistake beginner users make when using git.
you accidentally created branch br-02
branch br-01
. 1 solution create branch using correct base, , cherry-pick commits have made on br-02
onto correct branch.
git checkout bs-00 # switch correct branch git checkout -b br-03 # create correct branch using bs-00 base git cherry-pick <sha-1> # cherry-pick commit br-02
here <sha-1>
hash of commit on branch br-02
wish keep. can find out value switching br-02
, typing git log
terminal.
note merging commit made on branch br-02
branch br-03
, there might conflicts. finally, can delete bad branch br-02
since don't need anymore:
git branch -d br-02 # delete wrong branch br-02 locally git push origin :br-02 # delete wrong branch br-02 on remote
Comments
Post a Comment