如何使用 git 查看所有文件自初始创建以来的更改?

How to use git to see changes to all files since their initial creation?

我正在尝试查看自初始提交以来我进行了哪些编辑。

当我从供应商导入和控制代码时,这种情况经常发生。

所以工作流程是这样的:

  1. git add/commit
  2. 进行编辑
  3. git commit
  4. 转到 2

我想查看自文件首次创建以来所有 我的 更改的记录。

git log -p -- <file> 不太有效,因为文件的初始创建显示为所有行中的一个巨大的附加部分。像这样:

commit 82abdc4cc52d70dcabdec4b987632f226a1e8bc4
Author: Greg Bell <greg@>
Date:   Fri Aug 26 07:13:22 2016 +1000

    initial import from vendor

diff --git a/vendor/source.h b/vendor/source.h
new file mode 100644
index 0000000..baf6d8a
--- /dev/null
+++ b/vendor/source.h
@@ -0,0 +1,221 @@
+/*
+ * Error codes returned by blah.
+ *
+ * Copyright (C) 1998-2000 blah blah
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, visit the http://fsf.org website.
+ */

+#define RERR_OK         0
+#define RERR_SYNTAX     1       /* syntax or usage error */
.
. (all 1250 lines shown)
.

当我 运行 记录整个目录而不是一个文件时,这会严重扰乱输出。

没有分支 - 可能是一个严重的初始错误,尽管根据我是引入新文件还是编辑现有文件(然后合并等)来切换分支会很讨厌

我认为让这件事变得困难的是文件可能随时进来,所以可能会在整个 git 历史中添加,所以我认为我不能使用 .. 或各种 revision syntaxes.

似乎是一个简单的用例,但我阅读了 git-log 的文档并进行了谷歌搜索,但没有得到任何结果。

如果我理解正确,您只想查看您所做的修改,而忽略新文件的添加。如果这确实是问题所在,您可以使用 --diff-filter 开关来限制您希望看到的更改类型,并发送 M(修改的缩写)参数:

$ git log --diff-filter=M -p -- <file>