How to make ‘git diff’ ignore comments

Here is a solution that is working well for me. I’ve written up the solution and some additional missing documentation on the git (log|diff) -G<regex> option. It is basically using the same solution as in previous answers, but specifically for comments that start with a * or a #, and sometimes a space before the … Read more

Ignore *all* whitespace changes with git-diff between commits

Perhaps there is a better answer, but the best solution I’ve found so far is this. First, you must control the definition of “whitespace” that Git is currently using. git config core.whitespace ‘-trailing-space,-indent-with-non-tab,-tab-in-indent’ Next, you must control the definition of a word used. Instead of just using git diff -w, add –word-diff-regex='[^[:space:]]’: git diff -w … Read more

How can I view file history in Git?

Use git log to view the commit history. Each commit has an associated revision specifier that is a hash key (e.g. 14b8d0982044b0c49f7a855e396206ee65c0e787 and b410ad4619d296f9d37f0db3d0ff5b9066838b39). To view the difference between two different commits, use git diff with the first few characters of the revision specifiers of both commits, like so: # diff between commits 14b8… and … Read more

Making git diff –stat show full file path

By default git diff truncates its output to fit into a 80-column terminal. You can override this by specifying values using the –stat option: –stat[=<width>[,<name-width>[,<count>]]] Generate a diffstat. You can override the default output width for 80-column terminal by –stat=<width>. The width of the filename part can be controlled by giving another width to it … Read more

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

tech