git diff – show me line ending changes?

First, make sure you’re using the coloured output (e.g. with git diff –color) and that you’ve enabled whitespace highlighting with (e.g.) git config color.diff.whitespace “red reverse” This might not work in all cases, however, as git doesn’t appear to highlight trailing whitespace for removed lines. To see whitespace that you’ve deleted, simply use git diff … Read more

git-diff to ignore ^M

GitHub suggests that you should make sure to only use \n as a newline character in git-handled repos. There’s an option to auto-convert: $ git config –global core.autocrlf true Of course, this is said to convert crlf to lf, while you want to convert cr to lf. I hope this still works … And then … Read more

How can I see the differences between two branches?

You want to use git diff. git diff [<options>] <commit>..​<commit> [–] [<path>…​] Where <commit> is your branch name, the hash of a commit or a shorthand symbolic reference For instance git diff abc123..def567 or git diff HEAD..origin/master That will produce the diff between the tips of the two branches. If you’d prefer to find the … 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

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

Since I’d already created these images, I thought it might be worth using them in another answer, although the description of the difference between .. (dot-dot) and … (dot-dot-dot) is essentially the same as in manojlds’s answer. The command git diff typically¹ only shows you the difference between the states of the tree between exactly … 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