How to get diff working like git-diff?

This will do the +/- rather than < and >. diff -u file1 file2 Since GNU diffutils 3.4 the flag –color has been added. Combining both makes the following: diff –color -u file1 file2 The flag –color also takes an argument, valid options are never, always, or auto. Useful when you want to be more … Read more

Git list of staged files

The best way to do this is by running the command: git diff –name-only –cached When you check the manual you will likely find the following: –name-only Show only names of changed files. And on the example part of the manual: git diff –cached Changes between the index and your current HEAD. Combined together, you … Read more

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

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

Git diff between current branch and master but not including unmerged master commits

git diff `git merge-base master branch`..branch Merge base is the point where branch diverged from master. Git diff supports a special syntax for this: git diff master…branch You must not swap the sides because then you would get the other branch. You want to know what changed in branch since it diverged from master, not … Read more