How to change base branch in git? -


problem described in image giving error in text.

enter image description here

enter image description here

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

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -