git多条commit提交合并成一条
2023-11-06 本文已影响0人
小猪x
注意
git rebase --abort
正文
如何把第2~6次提交合并成一次提交
![](https://img.haomeiwen.com/i4978076/dd74f93d7bbaad99.png)
1、选中需要合并的提交,选择 【Squash Commits】
![](https://img.haomeiwen.com/i4978076/fe4cfc9c6d3c778c.png)
2、会将选中的几次提交 message 合并在一起,重新编辑提交的message
![](https://img.haomeiwen.com/i4978076/921f21a313bde287.png)
git log 查看更改后的提交记录
![](https://img.haomeiwen.com/i4978076/1de337c12ae3582c.png)
然后执行 git push -f 覆盖远端即可。在远端查看符合预期
![](https://img.haomeiwen.com/i4978076/e4e78bb1fa5585c4.png)
git代码合并
![](https://img.haomeiwen.com/i4978076/d67b7f3b2b448931.png)
git rebase --abort
如何把第2~6次提交合并成一次提交
1、选中需要合并的提交,选择 【Squash Commits】
2、会将选中的几次提交 message 合并在一起,重新编辑提交的message
git log 查看更改后的提交记录
然后执行 git push -f 覆盖远端即可。在远端查看符合预期
git代码合并