diff

How to compare the working tree with a commit?

南笙酒味 提交于 2019-12-02 14:18:27
I'm using git diff mycommit for comparing my working tree with mycommit , but it seems to ignore files not present in the current index. You can reproduce it as follows: git init echo A > A.txt; git add .; git commit -m A; git branch A echo B > B.txt; git add .; git commit -m B; git branch B git reset --hard A echo BB > B.txt git diff B The output (as of git version 1.7.3.3) is empty. Using --diff-filter=ACDMRTUXB shows "deleted file" which is wrong as well, since the file B.txt exists both in the working tree and in commit B . IMHO, the file should be shown as modified. Surprisingly, it works

How to get diff working like git-diff?

北城以北 提交于 2019-12-02 13:59:59
I like the output formatting of git diff . The color and the + / - representation of changes between lines is easier to read than GNU diff. I can run git diff using --no-index flag outside of a git repo and it works fine. However, it appears to be missing the --exclude option for excluding files or subdirectories from a recursive diff . Is there a way to get the best of both worlds? (color options and + / - format of git diff and --exclude option of GNU diff). I've experimented with colordiff , but I still prefer the output format of git diff I don't know how to do color but this will do the +

diff to output only the file names

前提是你 提交于 2019-12-02 13:54:42
I'm looking to run a Linux command that will recursively compare two directories and output only the file names of what is different. This includes anything that is present in one directory and not the other or vice versa, and text differences. From the diff man page: -q Report only whether the files differ, not the details of the differences. -r When comparing directories, recursively compare any subdirectories found. Example command: diff -qr dir1 dir2 Example output (depends on locale): $ ls dir1 dir2 dir1: same-file different only-1 dir2: same-file different only-2 $ diff -qr dir1 dir2

Diff output from two programs without temporary files

点点圈 提交于 2019-12-02 13:52:52
Say I have too programs a and b that I can run with ./a and ./b . Is it possible to diff their outputs without first writing to temporary files? Use <(command) to pass one command's output to another program as if it were a file name. Bash pipes the program's output to a pipe and passes a file name like /dev/fd/63 to the outer command. diff <(./a) <(./b) Similarly you can use >(command) if you want to pipe something into a command. This is called "Process Substitution" in Bash's man page. Adding to both the answers, if you want to see a side by side comparison, use vimdiff : vimdiff <(./a) <(.

Graphical DIFF programs for linux [closed]

南楼画角 提交于 2019-12-02 13:51:57
I really like Araxis Merge for a graphical DIFF program for the PC. I have no idea what's available for linux , though. We're running SUSE linux on our z800 mainframe. I'd be most grateful if I could get a few pointers to what programs everyone else likes. faran I know of two graphical diff programs: Meld and KDiff3 . I haven't used KDiff3, but Meld works well for me. It seems that both are in the standard package repositories for openSUSE 11.0 BeyondCompare has also just been released in a Linux version. Not free, but the Windows version is worth every penny - I'm assuming the Linux version

Git diff -w ignore whitespace only at start & end of lines

放肆的年华 提交于 2019-12-02 13:48:03
I love to use git diff -w to ignore whitespace differences. But, I just noticed that it ignores even whitespace differences in the middle of lines. How could I only ignore whitespace differences that come at the start (^) or end ($) of lines? Fake Code Monkey Rashid For end of line use: git diff --ignore-space-at-eol Instead of what are you using currently: git diff -w (--ignore-all-space) For start of line... you are out of luck if you want a built in solution. However, if you don't mind getting your hands dirty there's a rather old patch floating out there somewhere that adds support for "-

Comparing the contents of two files in Sublime Text

て烟熏妆下的殇ゞ 提交于 2019-12-02 13:47:07
I have two cloned repositories of two very similar open-source projects, which I have been working on in different instances in Sublime Text 2 to arrive at my desired result. Code from both of these projects was used. I have been using Git as version control for my project, but have not included the original projects. Thus, I would like to be able to quickly compare the contents of two files of the original project and compare the differences between them and my project. I was hoping that Sublime Text 2 would have a "Compare File" feature, but I can't seem to find anything related to it in the

Compare three arrays in bash, diff and identical values [duplicate]

前提是你 提交于 2019-12-02 12:46:06
This question already has an answer here: Compare/Difference of two arrays in bash 7 answers This question refers to the answered question: Compare/Difference of two arrays in bash Let's take two arrays: Array1=( "key1" "key2" "key3" "key4" "key5" "key6" "key7" "key8" "key9" "key10" "key13" ) Array2=( "key1" "key2" "key3" "key4" "key5" "key6" "key11" "key12" "key13" ) Symetrical Differences between arrays: Array3=(`echo ${Array1[@]} ${Array2[@]} | tr ' ' '\n' | sort | uniq -u `) Array3 values: echo $Array3 key10 key11 key12 key7 key8 key9 Values only in Array1: echo ${Array1[@]} ${Array3[@]} |

How to find elements in array2 that are not in array1?

五迷三道 提交于 2019-12-02 11:47:36
I have two arrays: var a1 = [ { ID: 2, N:0 }, { ID: 1, N:0 } ]; var a2 = [ { ID: 1, N:0 }, { ID: 2, N:0 }, { ID: 3, N:0 } ]; I need to get all elements that are on a2 but not in a1 . An element here is distinct of another only by the property ID , the other properties should be ignored. And I cannot guarantee the order of the elements on the arrays. Meaning the result for this example should be: var result = [ { ID: 3, N:0 } ]; // result for the example above How can I do this in an efficient way? (I will be comparing arrays from 500 to 5,000 length) To do this efficiently, you need to build

Subversion diff --summarize only shows old paths

北战南征 提交于 2019-12-02 06:13:54
If I do this: svn diff --summarize --old http.../svn/project/trunk --new http.../svn/project/branches/branch I get a list like this: D http.../svn/project/trunk/deletedFile A http.../svn/project/trunk/addedFile M http.../svn/project/trunk/modifiedFile It only shows the old paths. Is there a way to get the new paths as well? I'm parsing this output, and I'd like to get these paths: http.../svn/project/branches/branch/deletedFile http.../svn/project/branches/branch/addedFile http.../svn/project/branches/branch/modifiedFile You are comparing the HEAD of trunk and the branch, essentially asking