Git 批量合并 commit

阅读量:

#开花

适用于批量合并连续的 commit

若需要合并 commit 在其他分支上,则运行

(feature)$  git checkout develop
(develop)$  git merge --squash feature
(develop)$  git add .
(develop)$  git commit -m "feat: This is a feature"

若需要合并当前分支上的 commit,则运行

(feature)$  git branch tmp feature~1000
(feature)$  git checkout tmp
(tmp)$  git merge --squash feature
(tmp)$  git add .
(tmp)$  git commit -m "feat: This is a feature"
(tmp)$  git checkout develop
(develop)$  git cherry-pick tmp
(develop)$  git branch -D tmp

参考资料

https://juejin.cn/post/7203690731277910072

反向链接

到头儿啦~

局部关系图