大量commit记录挑选合并后提交merge经验

114 阅读1分钟

创建空白文档按功能或类型把全部commitID分类

git bash 本地切换到基于要合并的分支克隆创建的临时分支

git cherry-pick commitID1 commitID3 commitID4 commitID7 ...

爆冲突就vscode解决冲突, 然后

git cherry-pick --continue

有重复被修改的commit就 git commit --allow-empty

直到全部合并

不要push,看本地刚刚一共有n个待提交的commit git rebase -i HEAD~n

I

除了第一个commit保持为 pick 其他的pick都改为s

ESC + :wq

I

然后把 # Please enter the commit message for your change... 这一行上面的内容全部删除,改为总结的唯一commit标题,如 feat(组件): 组件样式开发

:wq

git push (如果是合并已经push的提交,就改成 git push -f)

另: Git修改已经push了的commit信息

git commit --amend

git push -f