ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 概述 ### reflog - 可以查看所有分支的所有操作记录(包括commit和reset的操作),包括已经被删除的commit记录 ## 场景 ### 获取整个记录,但跳过合并 ``` > git log --no-merges 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 ``` ### 显示最近三次的提交 ``` git log -3 ``` ### 一行显示日志 ``` > git log --oneline 12e21605 [添加]远程控制其他服务器的服务 8519d0e4 消息统计工具 - 兼容火狐 b7ee843e 增加群组大小配置项#78 3d9dcaef 添加 跨域是否可发送消息 1=仅可发送普通消息 0=可发送所有消息 4b915417 增加群组大小配置项#78 ``` ### 查询指定作者的提交记录 ``` git log --author=maxsu ``` ### 按时间查询 ``` git log --before={2018-11-11} --after={2018-12-12} ``` ### 显示文件修改记录 ``` > git log --stat --oneline 12e21605 [添加]远程控制其他服务器的服务 Application/Ms/Controller/ServerController.class.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 8519d0e4 消息统计工具 - 兼容火狐 Application/Api/Controller/MsgCountController.class.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) ``` ### 图标显示 ``` > git log --graph --oneline * 005a12e3 中心创建的群永远是互联群 * 8327274e Merge branch of http://192.168.0.40/bigant/web/ant_universal into |\ | * abfa8963 Merge remote-tracking branch 'origin/28' into 28 | |\ | * | e3d70bca 改下版本号5.2.24->5.2.26 * | | f0fc37d9 暂时解决 json 中编码异常导致的 两个key值相同的问题 * | | 79ba5ab3 解决web后台在线统计i页面,不显示账号的问题 | |/ |/| ``` ### 自定义 format ``` #选项 #说明 %H 提交对象(commit)的完整哈希字串 %h 提交对象的简短哈希字串 %T 树对象(tree)的完整哈希字串 %t 树对象的简短哈希字串 %P 父对象(parent)的完整哈希字串 %p 父对象的简短哈希字串 %an 作者(author)的名字 %ae 作者的电子邮件地址 %ad 作者修订日期(可以用 -date= 选项定制格式) %ar 作者修订日期,按多久以前的方式显示 %cn 提交者(committer)的名字 %ce 提交者的电子邮件地址 %cd 提交日期 %cr 提交日期,按多久以前的方式显示 %s 提交说明 ``` 实例 ``` > # git log --pretty=format:"%an %ae %ad %cn %ce %cd %cr %s" 陈x杰 260083304@qq.com Thu Nov 12 14:34:04 2020 +0800 陈x杰 260083304@qq.com Thu Nov 12 14:34:04 2020 +0800 23 hours ago 分布配置添加后,自动推送到其他服务器-优化edgeconnection ``` ### 查看某个文件的日志 ``` > git log --oneline Application/Install/Controller/InstallController.class.php d07b3f3a 分布式 把 admin 等系统帐号前加区域id 9f995d94 安装时,自动设置root_id 8f8f0a76 安装时,自动设置root_id 822d6d8b 修改端口为3308 842dfa67 中心互联 设置 端口为3308 3fa548f5 Initial commit ``` ### reflag 查看所有分支的日志 ``` > git reflog f6b7db5 HEAD@{0}: cherry-pick: New Userbook. 102a67b HEAD@{1}: checkout: moving from new_branch_name to for-upload b077c1e HEAD@{2}: checkout: moving from for-upload to new_branch_name 102a67b HEAD@{3}: checkout: moving from b077c1e5db8cf32cf42b201d211a340493348348 to for-upload b077c1e HEAD@{4}: commit (amend): New Userbook. 51ed395 HEAD@{5}: commit (amend): New Userbook. 1def615 HEAD@{6}: commit (amend): New Userbook. c1c3262 HEAD@{7}: reset: moving to HEAD~1 ```