1.git log 查看commit 日志
看提交历史
在提交了若干更新之后,又或者克隆了某个项目,想回顾下提交历史,可以使用 git log
命令查看。
接下来的例子会用我专门用于演示的 simplegit 项目,运行下面的命令获取该项目源代码:
git clone git://github.com/schacon/simplegit-progit.git
然后在此项目中运行 git log
,应该会看到下面的输出:
$ git log
commit ca82a6dff817ec66f44342007202690a93763949
Author: Scott Chacon <schacon@gee-mail.com>
Date: Mon Mar 17 21:52:11 2008 -0700
changed the version number
commit 085bb3bcb608e1e8451d4b2432f8ecbe6306e7e7
Author: Scott Chacon <schacon@gee-mail.com>
Date: Sat Mar 15 16:40:33 2008 -0700
removed unnecessary test code
commit a11bef06a3f659402fe7563abf99ad00de2209e6
Author: Scott Chacon <schacon@gee-mail.com>
Date: Sat Mar 15 10:31:28 2008 -0700
first commit
2.恢复到某次提交
git reset <commit 码>
git reset --hard <commit 码>
参考链接