Git log 查看更新的详细日志信息
commit d7d6c09359a4df4457962982a09ba713f4016211 (HEAD -> master) -> 快照ID HEAD -> master当前分支
Author: thinksitelaowang01 <thinksite@126.com> ---提交者
Date: Wed Dec 27 11:03:01 2017 +0800 ----提交时间
Delete1 hello1.txt --------->本次提交的说明文字
注意:如果没有退出显示的结果就使用:q退出
git log --pretty=oneline 查看简易git更新日志
W@thinksite MINGW64 /d/thinksitegit (master)
$ git log --pretty=oneline
d7d6c09359a4df4457962982a09ba713f4016211 (HEAD -> master) delete hello1.txt
c18161641718a9f0c81c9b87aeea90949513b25b modify hello.txt
2afbe025603a89ce0e1e64c8f9e6475eeaad6bbf add more hello1.txt hello2.txt
a630654e622f39cb6175d3b4166f69baccaac977 add file hello.txt
git reset --hard HEAD^ 或者HEAD~100 或者快照id 回到上一个版本
W@thinksite MINGW64 /d/thinksitegit (master)
$ git status
On branch master
nothing to commit, working tree clean
W@thinksite MINGW64 /d/thinksitegit (master)
$ git reset --hard HEAD^^
HEAD is now at 2afbe02 add more hello1.txt hello2.txt
W@thinksite MINGW64 /d/thinksitegit (master)
$ git log
commit 2afbe025603a89ce0e1e64c8f9e6475eeaad6bbf (HEAD -> master)
Author: thinksitelaowang01 <thinksite@126.com>
Date: Wed Dec 27 10:38:53 2017 +0800
add more hello1.txt hello2.txt
commit a630654e622f39cb6175d3b4166f69baccaac977
Author: thinksitelaowang01 <thinksite@126.com>
Date: Wed Dec 27 10:20:44 2017 +0800
add file hello.txt
Git reflog 查看用所有指令操作
Git reset --hard 快照id 回到某个快照
W@thinksite MINGW64 /d/thinksitegit (master)
$ git log
commit 2afbe025603a89ce0e1e64c8f9e6475eeaad6bbf (HEAD -> master)
Author: thinksitelaowang01 <thinksite@126.com>
Date: Wed Dec 27 10:38:53 2017 +0800
add more hello1.txt hello2.txt
commit a630654e622f39cb6175d3b4166f69baccaac977
Author: thinksitelaowang01 <thinksite@126.com>
Date: Wed Dec 27 10:20:44 2017 +0800
add file hello.txt
W@thinksite MINGW64 /d/thinksitegit (master)
$ cat hello.txt
welcome to git
W@thinksite MINGW64 /d/thinksitegit (master)
$ git reflog
2afbe02 (HEAD -> master) HEAD@{0}: reset: moving to HEAD^^
d7d6c09 HEAD@{1}: commit: delete hello1.txt
c181616 HEAD@{2}: reset: moving to c18161641718a9f0c81c9b87aeea90949513b25b
b246ad0 HEAD@{3}: checkout: moving from master to master
b246ad0 HEAD@{4}: commit: delete hello1.txt
9f5f3a3 HEAD@{5}: commit: delete hello1.txt
c181616 HEAD@{6}: commit: modify hello.txt
2afbe02 (HEAD -> master) HEAD@{7}: commit: add more hello1.txt hello2.txt
a630654 HEAD@{8}: commit (initial): add file hello.txt
W@thinksite MINGW64 /d/thinksitegit (master)
$ git reset --har d7d6c09
HEAD is now at d7d6c09 delete hello1.txt
W@thinksite MINGW64 /d/thinksitegit (master)
$ git log
commit d7d6c09359a4df4457962982a09ba713f4016211 (HEAD -> master)
Author: thinksitelaowang01 <thinksite@126.com>
Date: Wed Dec 27 11:03:01 2017 +0800
delete hello1.txt
commit c18161641718a9f0c81c9b87aeea90949513b25b
Author: thinksitelaowang01 <thinksite@126.com>
Date: Wed Dec 27 10:46:10 2017 +0800
modify hello.txt
commit 2afbe025603a89ce0e1e64c8f9e6475eeaad6bbf
Author: thinksitelaowang01 <thinksite@126.com>
Date: Wed Dec 27 10:38:53 2017 +0800
add more hello1.txt hello2.txt
commit a630654e622f39cb6175d3b4166f69baccaac977
Author: thinksitelaowang01 <thinksite@126.com>
Date: Wed Dec 27 10:20:44 2017 +0800
add file hello.txt