按照操作步骤执行:
$ git rebase -i 412cf8956b0
interactive rebase in progress; onto 412cf89
Last command done (1 command done):
pick 412cf89
Next commands to do (2 remaining commands):
squash 26f91ae
pick d2672bf create a complete web page
You are currently rebasing branch 'master' on '412cf89'.
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 reset'
Could not apply 412cf89...
上面报错:
按照提示进行执行:
$ git reset 将当前头重置为指定状态
查看状态:
$ git status
interactive rebase in progress; onto 412cf89
Last command done (1 command done):
pick 412cf89
Next commands to do (2 remaining commands):
squash 26f91ae
pick d2672bf create a complete web page
(use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'master' on '412cf89'.
(use "git commit --amend" to amend the current commit)
(use "git rebase --continue" once you are satisfied with your changes)
nothing to commit, working tree clean
按照上面的最后一个提示执行命令操作:
$ git rebase --continue
[detached HEAD 025e988] add readme.md
Date: Tue Dec 25 10:40:05 2018 +0800
1 file changed, 1 insertion(+)
create mode 100644 readme.md
Successfully rebased and updated refs/heads/master.
最后结果如下:
$ git log --graph
* commit 49f3cf97cbe396469641a43569ea7b4dd38b2edf (HEAD -> master)
| Author: zhangdan <1375666272@qq.com>
| Date: Tue Dec 25 10:54:24 2018 +0800
|
| create a complete web page
|
| add index + logo
|
| add style.css
|
| add js
|
| add a pro
|
* commit 025e988b6516bf97db8bf14aa56ea7ab1a2ab1b7
Author: zhangdan <1375666272@qq.com>
Date: Tue Dec 25 10:40:05 2018 +0800
add readme.md
add readme
move file readme to readme.md
展开
作者回复: 嗯,多实践,看看结果是不是自己想要的。