Should diff3 be default conflictstyle on git?

For other readers (and from this article): git has an option to display merge conflicts in diff3 format (by default it only displays the two files to be merged). You can enable it like so: git config –global merge.conflictstyle diff3 There’s really no reason you shouldn’t enable the diff3 style, because you frequently need the … Read more

What’s the difference between `git diff –patience` and `git diff –histogram`?

This histogram strategy was introduced in git 1.7.7 (Sept 2011), with the following description (as mentioned by the OP) “git diff” learned a “–histogram” option to use a different diff generation machinery stolen from jgit, which might give better performance. JGit includes src/org/eclipse/jgit/diff/HistogramDiff.java and tst/org/eclipse/jgit/diff/HistogramDiffTest.java The description there is fairly complete: HistogramDiff An extended form … Read more

Export only modified and added files with folder structure in Git

git diff-tree -r –no-commit-id –name-only –diff-filter=ACMRT $commit_id git diff-tree -r $commit_id: Take a diff of the given commit to its parent(s) (including all subdirectories, not just the top directory). –no-commit-id –name-only: Do not output the commit SHA1. Output only the names of the affected files instead of a full diff. –diff-filter=ACMRT: Only show files added, … 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

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” does nothing

The default output for git diff is the list of changes which have not been committed / added to the index. If there are no changes, then there is no output. git diff [–options] [–] […] This form is to view the changes you made relative to the index (staging area for the next commit). … Read more