假设我有一个commit已经push到远端了,现象我想加一个新的commit,并且合二为一后,在push到远端,我可以这样做:
这时候编辑界面打开,注意是倒叙的,旧的在上,新的在下。
保留最上面一个pick,其余pick都改成s。保存文件退出。
这时候,进入第二个编辑界面,组织一下语言,把commit message重新写一下。
保存退出。
Push到远端:
还有一种方法,假设最近的3个commit需要压缩成1个,可以这样:
https://www.internalpointers.com/post/squash-commits-into-one-git
https://stackoverflow.com/questions/5667884/how-to-squash-commits-in-git-after-they-have-been-pushed
https://stackoverflow.com/questions/5189560/squash-my-last-x-commits-together-using-git
作者:louyang
链接:https://www.jianshu.com/p/86f8aecb6c41
来源:简书
著作权归作者所有。非商业转载请注明出处。
联系客服