G:\mygitea\GitLearn\learn03 master $ git log --oneline --graph master * 7fd2c5d (HEAD -> master) add test info to readme * 30636df add test file * ac94160 add Third commit info to readme * e232742 add The Second commit info to readme * 342ea2f add First commit info to readme
我们继续使用git rebase -i 342ea2f命令:
1 2
G:\mygitea\GitLearn\learn03 master $ git rebase -i 342ea2f
interactive rebase in progress; onto 342ea2f Last commanddone (1 commanddone): pick 342ea2f Next commands to do (4 remaining commands): squash e232742 add The Second commit info to readme squash ac94160 add Third commit info to readme (use "git rebase --edit-todo" to view and edit) You are currently rebasing branch 'master' on '342ea2f'. (all conflicts fixed: run "git rebase --continue")
nothing to commit, working tree clean The previous cherry-pick is now empty, possibly due to conflict resolution. If you wish to commit it anyway, use:
git commit --allow-empty
Otherwise, please use 'git rebase --skip' Could not apply 342ea2f...
G:\mygitea\GitLearn\learn03 HEAD detached at 342ea2f $ git status interactive rebase in progress; onto 342ea2f Last commanddone (1 commanddone): pick 342ea2f Next commands to do (4 remaining commands): squash e232742 add The Second commit info to readme squash ac94160 add Third commit info to readme (use "git rebase --edit-todo" to view and edit) You are currently rebasing branch 'master' on '342ea2f'. (all conflicts fixed: run "git rebase --continue")
nothing to commit, working tree clean
这里提示不连续,我们继续输入git rebase --continue继续rebase:
这里我们添加一行message,对这几个message进行概括,提交:
1 2 3 4 5 6 7
G:\mygitea\GitLearn\learn03 $ git rebase --continue [detached HEAD 16ce92b] add info to readme Date: Wed May 11 09:02:40 2022 +0800 1 file changed, 4 insertions(+) create mode 100644 readme Successfully rebased and updated refs/heads/master.
看到出现上面的信息,我们的变基就已经结束了,此时分支的commit的情况如下:
1 2 3 4 5 6 7
G:\mygitea\GitLearn\learn03 master $ git log --oneline --graph master * 7a7836e (HEAD -> master) add test file * 16ce92b add info to readme