diff to output only the file names

From the diff man page: -q   Report only whether the files differ, not the details of the differences. -r   When comparing directories, recursively compare any subdirectories found. Example command: diff -qr dir1 dir2 Example output (depends on locale): $ ls dir1 dir2 dir1: same-file different only-1 dir2: same-file different only-2 $ diff -qr … Read more

How can I expand/collapse a diff sections in Vimdiff?

Aside from the ones you mention, I only use the following frequently when diffing: :diffupdate :diffu -> recalculate the diff. It is useful when, after making several changes, Vim isn’t showing minimal changes anymore. Note that it only works if the files have been modified inside vimdiff. Otherwise, use: :e to reload the files if … Read more

How to read the output from git diff?

Lets take a look at example advanced diff from git history (in commit 1088261f in git.git repository): diff –git a/builtin-http-fetch.c b/http-fetch.c similarity index 95% rename from builtin-http-fetch.c rename to http-fetch.c index f3e63d7..e8f44ba 100644 — a/builtin-http-fetch.c +++ b/http-fetch.c @@ -1,8 +1,9 @@ #include “cache.h” #include “walker.h” -int cmd_http_fetch(int argc, const char **argv, const char *prefix) +int … Read more

Can I use git diff on untracked files?

With recent git versions you can git add -N the file (or –intent-to-add), which adds a zero-length blob to the index at that location. The upshot is that your “untracked” file now becomes a modification to add all the content to this zero-length file, and that shows up in the “git diff” output. git diff … Read more

Exclude file from “git diff”

Omg, drivers and awk to exclude a lousy file ? Since git 1.9 something you can: git diff — . ‘:(exclude)db/irrelevant.php’ ‘:(exclude)db/irrelevant2.php’ (On Windows, replace the single quotes ‘ by double quotes “.) Ah, elegance! See the quoted answer and for details this answer by @torek