git squash 和 git rebase
In git, what is the difference between merge --squash and rebase? 上面链接的回答中的总结: Both git merge --squash and git rebase --interactive can produce a "squashed" commit. So the differences are: one does not touch your source branch (tmp here) and creates a single commit where you want. the other allows you to go on on the same source branch with: a new base a cleaner history git squash squash (聚合) 假设从master分支有三个节点C1,C2,C3 从C3切出develop分支,并在develop分支上开发了C4,C5 现在切回master分支,将develop分支合并到master。如果使用聚合的方式进行合并的话,那么git会将develop分支上所有的commit压缩成一个新的commit为C6直接合并到master分支。 最后master分支上的节点为C1,C2,C3,C6 git详解之三