git diff file against its last change

This does exist, but it’s actually a feature of git log: git log -p [-m] [–follow] [-1] <path> Note that -p can also be used to show the inline diff from a single commit: git log -p -1 <commit> Options used: -p (also -u or –patch) is hidden deeeeeeeep in the git-log man page, and … 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

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

Show diff between commits

Try git diff k73ud^..dj374 to make sure to include all changes of k73ud in the resulting diff. git diff compares two endpoints (instead of a commit range). Since the OP want to see the changes introduced by k73ud, he/she needs to difference between the first parent commit of k73ud: k73ud^ (or k73ud^1 or k73ud~). That … Read more

What are the differences between double-dot “..” and triple-dot “…” in Git commit ranges?

Using Commit Ranges with Git Log When you’re using commit ranges like .. and … with git log, the difference between them is that, for branches A and B, git log A..B will show you all of the commits that B has that A doesn’t have, while git log A…B will show you both the … Read more