1状婶、git reflog : 查看操作記錄
$ git reflog
c1c1b21 HEAD@{0}: commit (amend): add blank line to index.html
9ff821d HEAD@{1}: commit: add blank line to index.html
b078331 HEAD@{2}: commit: no more commit!
b86e902 HEAD@{3}: commit: so many commit
77e6ce9 HEAD@{4}: commit: this is another commit
ccde039 HEAD@{5}: commit: this is a commit
a49dcf4 HEAD@{6}: clone: from ssh://liux@xxx.xx.xx.xxx:29418/git_test.git
2、撤銷某次記錄
git reset --soft HEAD@{1} 撤銷到暫存區(qū)
git reset --hard HEAD@{1} 干掉這個(gè)修改
// 撤銷上次commit amend操作
$ git reset --soft HEAD@{1}
// 查看狀態(tài), 發(fā)現(xiàn) amend 的內(nèi)容已經(jīng)被撤銷 (到工作區(qū)) 了
$ git status
On branch master
Your branch is ahead of 'origin/master' by 5 commits.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: index.html