git ---squash : 合并多次提交

739 阅读1分钟

1,显示3次commit记录

git rebase –i HEAD~3

image.png 2,把要合并的记录的 pick 改成 s 输入":wq”退出。

image.png

3, 这时git会合并commit。并提示输入新的message(就是我们常说的comments),如下:

把 新的comment 插入第二行 也就是 ‘#this is a combination....’下面插入一行

image.png

4,提交到remote repo

git push --force

ps:注意要加上force ,否则会报错

image.png