合并多个 commit
git rebase -i commit // 此处的 commit 是不需要合并的 commit
进入编辑模式,选择将要使用的 commit
。
-
pick
-> 执行这个 commit -
squash
-> 将此 commit 合并到上一个 commit
注意:
- 此过程中使用
:wq
,不要使用:wq!
- 在过程如果有错误操作,使用
git rebase --abort
撤销更改
合并某个分支上的单个 commit
git checkout master
git cherry-pick commit
回退版本
git reset --hard commit
网友评论