美文网首页
git 查看提交了哪些文件(命令行 git show)

git 查看提交了哪些文件(命令行 git show)

作者: PHP的点滴 | 来源:发表于2019-06-26 10:39 被阅读0次

有时候想快速查看某个提交中,修改了哪些文件,而又不想打开git图形管理工具,那么直接两个命令就可以搞定了。
查看某次提交中,修改了哪些文件,可以分以下几个步骤:

1. 通过 git log 获取提交的 commit id

jason@local Dos$ git log
commit 33edda5b930d5a366e5d5913cb64e961c6800743
Author: Jason Wang <xxxxx@qq.com>
Date:   Tue Jun 25 17:53:28 2019 +0800

    提交测试说明

附加说明:

  • 提交id 即: SHA-1 校验和(33edda5b930d5a366e5d5913cb64e961c6800743)
  • 作者的名字和电子邮件地址
  • 提交时间
  • 提交说明

2. 使用 git show [commit id] | grep diff | cut -d" " -f 3 查看提交的信息

jason@local Dos$ git show e626c5adb3c9e4e01dca599e78513394a7e06e16 | grep  diff | cut -d" " -f 3 
a/application/common/controller/xxx.php
a/application/test/controller/xxxx.php

或者 git show e626c5adb3c9e4e01dca599e78513394a7e06e16 | grep diff | awk '{print $3}'

附加说明
git show e626c5ad 命令,如果不经过筛选的话,返回内容如下

jason@local Dos$ git show e626c5adb3c9e4e01dca599e78513394a7e06e16
commit e626c5adb3c9e4e01dca599e78513394a7e06e16 (HEAD -> master, origin/master, origin/HEAD)
Author: Jason Wang <xxx@qq.com>
Date:   Wed Jun 26 09:47:02 2019 +0800

    提交测试说明

diff --git a/application/common/controller/Pdf.php b/application/common/controller/Pdf.php
index a1cbd4b..3af7ee6 100644
--- a/application/common/controller/xxx.php
+++ b/application/common/controller/xxx.php
@@ -326,11 +326,11 @@ class xxx extends a {
-    public function getCover(){
+    public function getCover($model){
-                <b>Aaaaaa</b></span>
+                <b>Abbbbb</span>
diff --git a/application/test/controller/Index.php b/application/test/controller/Index.php
index e565710..1a4fb88 100644
--- a/application/test/controller/xxx.php
+++ b/application/test/controller/xxx.php

相关文章

  • git 查看提交了哪些文件(命令行 git show)

    有时候想快速查看某个提交中,修改了哪些文件,而又不想打开git图形管理工具,那么直接两个命令就可以搞定了。查看某次...

  • git查看提交记录详情

    git 查看commit 提交记录详情 git log //查看所有的提交记录 git show //查看最新的提...

  • Git常用命令

    git remote -v : 查看当前配置有哪些远程仓库 git remote show [remote-nam...

  • 简单随笔

      今日所学: Android Studio查看单个文件的git log,选中目标文件,右键->git->show...

  • git命令集合

    查看、添加、提交、删除、找回,重置修改文件 git help # 显示command的help git show...

  • Git命令

    查看、添加、提交、删除、找回,重置修改文件 git help # 显示command的help git show...

  • git基本命令操作

    查看、添加、提交、删除、找回,重置修改文件 git help# 显示command的help git show #...

  • git常用命令

    查看、添加、提交、删除、找回,重置修改文件 git help # 显示command的help git show...

  • Git常用命令

    查看、添加、提交、删除、找回,重置修改文件 git help # 显示command的help git show...

  • Git常用命令篇(十)

    查看、添加、提交、删除、找回,重置修改文件 git help# 显示command的help git show #...

网友评论

      本文标题:git 查看提交了哪些文件(命令行 git show)

      本文链接:https://www.haomeiwen.com/subject/yyyqcctx.html