diff

Coloring white space in git-diff's output

会有一股神秘感。 提交于 2019-11-26 23:32:31
Regarding code formatting I'm kind of purist :). I very often remove unnecessary white spaces (lines with only ws, ws at the end of lines etc). I even have set vim to show that kind of lines colored to red. My problem is that using git-diff I often see something like this: - else{ + else{ Even if I have git-diff colored I can't see difference (in that particular situation I removed 1 ws at the end of line). Is there any way to tell git-diff to show that ws colored to red? (for example those matched with /\s+$/ regexp). Mark Longair You may need to set the color.diff.whitespace config setting,

What is the Windows equivalent of the diff command?

▼魔方 西西 提交于 2019-11-26 23:29:54
I know that there is a post similar to this : here . I tried using the comp command like it mentioned, but if I have two files, one with data like "abcd" and the other with data "abcde", it just says the files are of different sizes. I wanted to know where exactly they differ. In Unix, the simple diff tells me which row and column, the comp command in windows works if I have something like "abd" and "abc". Not otherwise. Any ideas what I can use for this? Run this in the CMD shell or batch file: FC file1 file2 FC can also be used to compare binary files: FC /B file1 file2 Well, on Windows I

How to set Araxis as diff / merge tool for MSYS git?

落花浮王杯 提交于 2019-11-26 22:51:16
问题 I'm trying to use Araxis Merge as my diff / merge tool for MSYSGit. I found a few resources on the net: On the Araxis site, they mention an "easy" way, but it implies a executables (araxisgitdiff.exe and araxisgitmerge.exe) that are not part of my distro. I also found some info in gitguru, but the actual information re: Araxis is sparse at best, and I could not make anything out of that. Finally, there was some info on an older stackoverflow post, but the suggested method doesn't work for me.

Calculate text diffs in PHP [duplicate]

耗尽温柔 提交于 2019-11-26 22:34:49
This question already has an answer here: Highlight the difference between two strings in PHP 12 answers Are there any libraries (3rd party or built-in) in PHP to calculate text diffs? What sort of diffs? File diffs? There is array_diff() which acts on arrays. Then there is also xdiff , which "enables you to create and apply patch files containing differences between different revisions of files.". The latter acts on files or strings. Edit: I should add xdiff doesn't appear to be out in a release yet. You have to build from source to use it. it depends exactly what you mean and what you want

Calculate difference from previous item with LINQ

喜夏-厌秋 提交于 2019-11-26 22:01:20
I'm trying to prepare data for a graph using LINQ. The problem that i cant solve is how to calculate the "difference to previous. the result I expect is ID= 1, Date= Now, DiffToPrev= 0; ID= 1, Date= Now+1, DiffToPrev= 3; ID= 1, Date= Now+2, DiffToPrev= 7; ID= 1, Date= Now+3, DiffToPrev= -6; etc... Can You help me create such a query ? using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { public class MyObject { public int ID { get; set; } public DateTime Date { get; set; } public int Value { get; set; } } class Program { static

How resolve multiple conflicts with “git mergetool” without having to close the editor between files?

扶醉桌前 提交于 2019-11-26 21:53:33
I've found git mergetool to be a handy utility for merging diffs visually, but the way I'm going about it seems really wonky. Essentially, my process looks like this when conflicts are reported: Execute a git mergetool At the prompt, hit Enter to launch my diff tool (Meld or FileMerge, depending on which computer) Resolve the conflicts Save the changes Close the diff tool If I have more than one conflict, rinse, repeat. Yep, that's me opening and closing my diff viewer once for each conflict in the merge. Since it's launched from the command line, closing it is the only way I know of to tell

how to show lines in common (reverse diff)?

▼魔方 西西 提交于 2019-11-26 21:23:07
I have a series of text files for which I'd like to know the lines in common rather than the lines which are different between them. Command line unix or windows is fine. foo: linux-vdso.so.1 => (0x00007fffccffe000) libvlc.so.2 => /usr/lib/libvlc.so.2 (0x00007f0dc4b0b000) libvlccore.so.0 => /usr/lib/libvlccore.so.0 (0x00007f0dc483f000) libc.so.6 => /lib/libc.so.6 (0x00007f0dc44cd000) bar: libkdeui.so.5 => /usr/lib/libkdeui.so.5 (0x00007f716ae22000) libkio.so.5 => /usr/lib/libkio.so.5 (0x00007f716a96d000) linux-vdso.so.1 => (0x00007fffccffe000) So, given these two files above the output of the

In the context of git (and diff), what is a “hunk”

落爺英雄遲暮 提交于 2019-11-26 21:20:17
问题 I was looking for a definition of "hunk" while reading some git documentation. I know it means a description of the difference between two files and that it has a well defined format, but I couldn't call to mind a succinct definition. I tried searching with google, but there were a lot of somewhat spurious hits. 回答1: And eventually I found this: When comparing two files, diff finds sequences of lines common to both files, interspersed with groups of differing lines called hunks. here: http:/

Myers diff algorithm vs Hunt–McIlroy algorithm

◇◆丶佛笑我妖孽 提交于 2019-11-26 20:43:58
问题 The longest common subsequence problem is a classic computer science problem, algorithms to solve it are the root of version control systems and wiki engines. Two basic algorithms are the Hunt–McIlroy algorithm which was used to create the original version of diff , and the Myers diff algorithm which is used by the GNU diff utility currently. Both seem to work more or less by finding the shortest path through a graph that represents the edit space between the two strings or text files. The

compare object properties and show diff in PHP

馋奶兔 提交于 2019-11-26 20:38:31
问题 I'm searching for a way to show me the different properties/values from given objects... $obj1 = new StdClass; $obj1->prop = 1; $obj2 = new StdClass; $obj2->prop = 2; var_dump(array_diff((array)$obj1, (array)$obj2)); //output array(1) { ["prop"]=> int(1) } This works very well as long the property is not a object or array. $obj1 = new StdClass; $obj1->prop = array(1,2); $obj2 = new StdClass; $obj2->prop = array(1,3); var_dump(array_diff((array)$obj1, (array)$obj2)) // Output array(0) { } //