在使用 Git 提交了若干更新之后,又或者克隆了某个项目,想回顾下提交历史,我们可以使用 git log 命令查看。

针对我们前一章节的操作,使用 git log 命令列出历史提交记录如下:$ git log

commit 88afe0e02adcdfea6844bb627de97da21eb10af1

Merge: 14b4dca d7e7346

Author: w3cschool

Date:   Sun Mar 1 15:03:42 2015 +0800

Merge branch 'change_site'

Conflicts:

test.txt

commit 14b4dcadbdc847207651d5a9fae0d315057f346e

Author: w3cschool

Date:   Sun Mar 1 14:53:15 2015 +0800

新增加一行

commit d7e734640da06055e107eaf29cf350b3f1de1c2c

Author: w3cschool

Date:   Sun Mar 1 14:48:57 2015 +0800

changed the site

commit 556f0a0637978097b82287ac665a717623b21f3f

Author: w3cschool

Date:   Sun Mar 1 14:40:34 2015 +0800

removed test2.txt

我们可以用 --oneline 选项来查看历史记录的简洁的版本。$ git log --oneline

88afe0e Merge branch 'change_site'

14b4dca 新增加一行

d7e7346 changed the site

556f0a0 removed test2.txt

2e082b7 add test2.txt

048598f add test.txt

85fc7e7 test comment from w3cschool.cc

这告诉我们的是,此项目的开发历史。

我们还可以用 --graph 选项,查看历史中什么时候出现了分支、合并。以下为相同的命令,开启了拓扑图选项:$ git log --oneline --graph

*   88afe0e Merge branch 'change_site'

|\

| * d7e7346 changed the site

* | 14b4dca 新增加一行

|/

* 556f0a0 removed test2.txt

* 2e082b7 add test2.txt

* 048598f add test.txt

* 85fc7e7 test comment from w3cschool.cc

现在我们可以更清楚明了地看到何时工作分叉、又何时归并。

你也可以用 '--reverse'参数来逆向显示所有日志。$ git log --reverse --oneline

85fc7e7 test comment from w3cschool.cc

048598f add test.txt

2e082b7 add test2.txt

556f0a0 removed test2.txt

d7e7346 changed the site

14b4dca 新增加一行

88afe0e Merge branch 'change_site'

如果只想查找指定用户的提交日志可以使用命令:git log --author , 例如,比方说我们要找 Git 源码中 Linus 提交的部分:$ git log --author=Linus --oneline -5

81b50f3 Move 'builtin-*' into a 'builtin/' subdirectory

3bb7256 make "index-pack" a built-in

377d027 make "git pack-redundant" a built-in

b532581 make "git unpack-file" a built-in

112dd51 make "mktag" a built-in

如果你要指定日期,可以执行几个选项:--since 和 --before,但是你也可以用 --until 和 --after。

例如,如果我要看 Git 项目中三周前且在四月十八日之后的所有提交,我可以执行这个(我还用了 --no-merges 选项以隐藏合并提交):$ git log --oneline --before={3.weeks.ago} --after={2010-04-18} --no-merges

5469e2d Git 1.7.1-rc2

d43427d Documentation/remote-helpers: Fix typos and improve language

272a36b Fixup: Second argument may be any arbitrary string

b6c8d2d Documentation/remote-helpers: Add invocation section

5ce4f4e Documentation/urls: Rewrite to accomodate transport::address

00b84e9 Documentation/remote-helpers: Rewrite description

03aa87e Documentation: Describe other situations where -z affects git diff

77bc694 rebase-interactive: silence warning when no commits rewritten

636db2c t3301: add tests to use --format="%N"

php读git历史,Git 查看提交历史相关推荐

  1. 4.Git基础-查看提交历史

    1.查看提交历史 --  git log  使用 git log 可以查看到所有的提交(commit)历史. 1. $ git log 列出所有commit,最新的commit在最上面.会显示每个提交 ...

  2. git 使用详解(5)—— get log 查看提交历史

    git log 查看 提交历史 在提交了若干更新之后,又或者克隆了某个项目,想回顾下提交历史,可以使用 git log 命令查看. 接下来的例子会用我专门用于演示的 simplegit 项目,运行下面 ...

  3. Git 查看提交历史

    Git 查看提交历史 在使用 Git 提交了若干更新之后,又或者克隆了某个项目,想回顾下提交历史,我们可以使用 git log 命令查看. 使用 git log 命令列出历史提交记录如下: $ git ...

  4. 查看提交历史 —— Git 学习笔记 11

    查看提交历史 查看提交历史 不带任何选项的git log -p选项 --stat 选项 --pretty=oneline选项 --pretty=format选项 git log常用选项列表 参考资料 ...

  5. git 历史操作日志_Git - 查看提交历史

    查看提交历史 在提交了若干更新,又或者克隆了某个项目之后,你也许想回顾下提交历史. 完成这个任务最简单而又有效的工具是 git log 命令. 我们使用一个非常简单的 "simplegit& ...

  6. git回退历史版本无法上传_Git实用教程(四) | Git本地库操作(查看提交历史、版本前进回退)...

    Git实用教程专栏回顾 Git实用教程(一) | 为什么需要版本控制?(以嵌入式项目开发为例) Git实用教程(二) | Git简介及安装详解 Git实用教程(三) | Git本地库操作(仓库初始化. ...

  7. Git笔记(6) 查看提交历史

    Git笔记(6) 查看提交历史 1. 提交历史 2. 查看 3. 常用选项 3.1. 差异 3.2. 总结 3.3. 自定义格式 3.3.1. 整合一行 3.3.2. 详尽程度 3.3.3. 定制格式 ...

  8. 2.3 Git 基础 - 查看提交历史

    查看提交历史 在提交了若干更新,又或者克隆了某个项目之后,你也许想回顾下提交历史. 完成这个任务最简单而又有效的工具是 git log 命令. 接下来的例子会用我专门用于演示的 simplegit 项 ...

  9. Git如何进行减少提交历史数量以及修改自己的commit中的邮箱

    Git如何进行减少提交历史数量以及修改自己的commit中的邮箱 注:本节中内容来自 https://git-scm.com/book/zh/v2/Git-工具-重写历史 最终解释权归该页面编撰者所有 ...

最新文章

  1. 快速给shell脚本加上使用提示
  2. 引擎设计跟踪(九.14.2i) Android GLES 3.0 完善
  3. c++中虚函数和纯虚函数定义
  4. Discuz x 默认模板文件目录说明
  5. String、StringBuffer、StringBuilder区别
  6. Sonarqube+maven 分析代码
  7. Linux中移动,复制,删除,打包排除某个目录或文件
  8. Oracle11新特性——初始化文件管理
  9. Educational Codeforces Round 45 (Rated for Div. 2) G - GCD Counting
  10. 通过collect埋点_通过Collect UI查找每日界面设计灵感
  11. 巧舟的逆转裁判开发手记
  12. 谷歌网盘扩容 - Google Drive Upgrade
  13. c# 获取照片的经纬度和时间
  14. MCNP 学习笔记之空气比释动能(F4 F5 计数卡)
  15. 【经典算法】:翻转句子中单词的顺序
  16. 底部孕线形态有哪些?底部孕线形态特征是什么?
  17. SAP FICO 如何看一个总账科目的修改记录?
  18. 常说的软件声卡指的是软件吗?
  19. Python中使用matplotlib画图时各种大小设置
  20. 使用PIA查找组件的PeopleSoft导航

热门文章

  1. 聚类算法之K-means
  2. web前端大作业:旅游网页主题网站设计——武汉旅游网页设计(11页)HTML+CSS+JavaScript
  3. 小程序开发文档中没有告诉你的一些事情
  4. VS2015 安装.NET Core
  5. 配置docker 代理,连接外部网络并下载docker镜像
  6. 金融壹账通TaaS平台继续发力
  7. 应用内版本更新库UpdateVersion
  8. 管理学书籍排行榜,这些书管理者必看
  9. php电子商务网站案例,基于PHP的B2C电子商务网站开发
  10. cannot launch node of type [map_server/map_server]: can't locate node [map_server] in package