I'm trying to perform some git surgery here. My series of commits currently looks like this:
A->B->C->D->E->F
and I want to transform it so that it looks like this (last commit in master is C
):
A->B->C
and
D->E->F
live in a branch off of commit C
How might I do this?
Simply create a new branch from your current master:
git checkout master
git checkout -b newBranch
git push -u origin newBranch
A-B-C-D-E-F (master, NewBranch)
Then reset master (making sure you don't have any work in progress)
git checkout master
git reset --hard C
A-B-C (master)
\
D-E-F (newBranch)
You will need to git push --force origin master
, so make sure you are the only one working on it.
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.