如果你有这样的需求,发版时,假设你的main branch上有200个commit,由于某些原因,你需要剔除前100个commit中的3个commit来发版,如果cherry pick的话,需要97次,这里有个简单做法:
git checkout main
git pull
git checkout -b newbranch
git rebase -i HEADE~100
-- in the vim editor, find the 3 commits that need to be deleted
-- change from "pick" to "drop"
-- press ESC
-- insert :wq to exit the vim editor
git rebase --continue
--resolve the conflict first time, you may need to resolve multiple times until there is no conflict
网友评论