1. git rebase -i
1.1 生成三个提交
1.2 合并后面两个提交
- git rebase -i [commit 1 hash]
- 至少需要一个提交为 pick, 而且pick 必须在 squash 上面
简单来说,其实就是将squash 提交合并到 pick 提交条件上
2. git reset --soft [commit-hash]
Essentially, it change HEAD pointer and branch pointer, and change HEAD space.
But index space and work space is as same as before.
And you can run git commit and generate a new commit.
3. git merge --squach [branch-name]
If you want to merge dev branch, and dev branch has many meaningless commit,
you can just run command git merge --squach [branch-name]