Greg Bell Greg Bell - 2 months ago 8
Git Question

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

I'm trying to see what edits I've made since an initial commit.

This happens a lot when I import and control code from a vendor.

So the workflow is like this:

  1. git add/commit

  2. make edits

  3. git commit

  4. go to 2

I'd like to see a record of all of my changes to the files since they were first created.

git log -p -- <file>
doesn't quite work because the file's initial creation shows up as one giant additional of all lines. Like so:

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
+ * 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 website.
+ */

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

This badly clutters the output when I'm running the log on the entire dir instead of just one file.

There are no branches - perhaps a critical initial mistake, though it would be nasty to have to switch branches based on whether I'm bringing in new files or editing existing ones (then merge, etc.)

What I think makes this hard is that files may come in at any time, so may be added all throughout the git history, so I don't think I can use .. or the various revision syntaxes.

Seems like a simple use case, but my reading of the documentation for git-log, and Googling, hasn't yielded anything.


If I understand correctly, you want to review only the modifications you've made, and ignore addition of new files. If this is indeed the issue, you can use the --diff-filter switch to limit what type of changes you want to see, and send the M (short for modifications) argument:

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