It was a stupid question. Sorry for deleting, but it wouldn't be helpful for anyone.
To change new_branch
checked out from target_branch
(or master
you can use same method):
git checkout target_branch
git cherry-pick target_branch..new_branch
git branch -f new_branch
git checkout new_branch
Note:
-If there has cherry-pick conflicts, you can modify and save the conflict files, then use git add .
and git cherry-pick --continue
. -If you don't want to rebase n ew_branch
on the top of target_branch
, you can use git checkout <an history commit of target_branch>
, and then use above commands to rebase new_branch
. As below graphs, if you use git checkout B, and after above commands, the branches will look like:
# Original branch structure
A---B---C target_branch
D---E---F new_branch
# After rebase new_branch from commit B
A---B---C target_branch
\
D'---E'---F' new_branch
To Resolve your issue, Go through below steps :
You are now at target_branch , Let's Delete Old Branch : new_branch
Now you & your friend can make new branches from target_branch & work on new_branch
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.