$ git log --pretty=raw --graph
* commit 943cbf390f0f303ef2326d9b425be10b9734e8a6| tree c66db9b13ea91d7bfb8733827c35638bd8705a56| parent 5fdeb61b5f4e8ee536388d614b16672a78cccaf9| author paohaijiao <goudingcheng@sina.com> 1453613536 +0800| committer paohaijiao <goudingcheng@sina.com> 1453613536 +0800|| commit3|* commit 5fdeb61b5f4e8ee536388d614b16672a78cccaf9| tree 08585692ce06452da6f82ae66b90d98b55536fca| parent 53dbfbd846c22b7af923163e7d8328d6511f373f| author paohaijiao <goudingcheng@sina.com> 1453612050 +0800| committer paohaijiao <goudingcheng@sina.com> 1453612050 +0800|| commit2|* commit 53dbfbd846c22b7af923163e7d8328d6511f373f tree 65a457425a679cbe9adf0d2741785d3ceabb44a7 author paohaijiao <goudingcheng@sina.com> 1453611723 +0800 committer paohaijiao <goudingcheng@sina.com> 1453611723 +0800 commitAdministrator@VJNPCNLRQR7J0ME /cygdrive/d/test/demo5git reset重置git refloggit reflog show master |head 5如果修改某个文件 (没有git add 已经被提交过)想撤销这次修改git checkout a.txt入股修改某个文件(git add已经在暂存区),想撤销这次修改git rest a.txt如果已修改某几个文件,但想撤销到某个版本,但是当前暂存区,工作区不想撤销git rest --soft commitid如果修改了几个文件也提交暂存区了,想撤销到某个commit(确定不要了)其实还可以找回git rest --hard commitid$ cat .git/headref: refs/heads/devAdministrator@VJNPCNLRQR7J0ME /cygdrive/d/test/demo5$ git branch -v* dev 943cbf3 commit3 master 943cbf3 commit3 $ git reflog943cbf3 HEAD@{0}: checkout: moving from master to dev943cbf3 HEAD@{1}: commit: commit35fdeb61 HEAD@{2}: commit: commit253dbfbd HEAD@{3}: commit (initial): commit分离头指针cat .git/headgit branchgit checkout git reflog挽救头指针git checkout git checkout file git checkout目录8.git checkout /git reset /git stash