diff

recursive array_diff()?

余生长醉 提交于 2019-11-26 03:31:58
问题 I\'m looking for some tool to give me a recursive diff of two arrays. What I envision is a web page with two color-coded tree-structures. On each tree, green are parts of the array which match in both arrays, and red is for parts of each that don\'t match the other. Something like the output of dBug I have some code that gives me a nested array to populate a report. I\'m developing a new method that should be faster, but I need to test the values and also the structure, to make sure it gives

How do I show the changes which have been staged?

帅比萌擦擦* 提交于 2019-11-26 03:31:05
问题 I staged a few changes to be committed; how can I see the diff of all files which are staged for the next commit? I\'m aware of git status, but I\'d like to see the actual diffs - not just the names of files which are staged. I saw that the git-diff(1) man page says git diff [--options] [--] […] This form is to view the changes you made relative to the index (staging area for the next commit). In other words, the differences are what you could tell git to further add to the index but you

How to remove the lines which appear on file B from another file A?

会有一股神秘感。 提交于 2019-11-26 03:16:36
问题 I have a large file A (consisting of emails), one line for each mail. I also have another file B that contains another set of mails. Which command would I use to remove all the addresses that appear in file B from the file A. So, if file A contained: A B C and file B contained: B D E Then file A should be left with: A C Now I know this is a question that might have been asked more often, but I only found one command online that gave me an error with a bad delimiter. Any help would be much

Can I make git recognize a UTF-16 file as text?

江枫思渺然 提交于 2019-11-26 03:06:54
I'm tracking a Virtual PC virtual machine file (*.vmc) in git, and after making a change git identified the file as binary and wouldn't diff it for me. I discovered that the file was encoded in UTF-16. Can git be taught to recognize that this file is text and handle it appropriately? I'm using git under Cygwin, with core.autocrlf set to false. I could use mSysGit or git under UNIX, if necessary. I've been struggling with this problem for a while, and just discovered (for me) a perfect solution: $ git config --global diff.tool vimdiff # or merge.tool to get merging too! $ git difftool commit1

Any decent text diff/merge engine for .NET? [closed]

这一生的挚爱 提交于 2019-11-26 02:05:01
问题 Requirements: free, preferably open-source implemented in one of the .NET managed langs Google found these: A Generic, Reusable Diff Algorithm on codeproject An O(ND) Difference Algorithm for C# Diff/Merge/Patch Library for C#/.NET by Joshua Tauberer EDIT: No apps please, only libraries. 回答1: You can grab the COM component that uses Google's Diff/Patch/Match. It works from .NET. Update, 2010 Oct 17 : The Google Diff/Patch/Merge code has been ported to C#. The COM component still works, but if

Highlight the difference between two strings in PHP

☆樱花仙子☆ 提交于 2019-11-26 01:23:58
问题 What is the easiest way to highlight the difference between two strings in PHP? I\'m thinking along the lines of the Stack Overflow edit history page, where new text is in green and removed text is in red. If there are any pre-written functions or classes available, that would be ideal. 回答1: You can use the PHP Horde_Text_Diff package. It suits your needs, and is quite customisable as well. It's also licensed under the GPL, so Enjoy! 回答2: Just wrote a class to compute smallest (not to be

Fast way of finding lines in one file that are not in another?

那年仲夏 提交于 2019-11-26 00:45:37
问题 I have two large files (sets of filenames). Roughly 30.000 lines in each file. I am trying to find a fast way of finding lines in file1 that are not present in file2. For example, if this is file1: line1 line2 line3 And this is file2: line1 line4 line5 Then my result/output should be: line2 line3 This works: grep -v -f file2 file1 But it is very, very slow when used on my large files. I suspect there is a good way to do this using diff(), but the output should be just the lines, nothing else,

Compare two MySQL databases [closed]

牧云@^-^@ 提交于 2019-11-25 23:17:48
问题 I\'m currently developing an application using a MySQL database. The database-structure is still in flux and changes while development progresses (I change my local copy, leaving the one on the test-server alone). Is there a way to compare the two instances of the database to see if there were any changes? While currently simply discarding the previous test server database is fine, as testing starts entering test data it could get a bit tricky. The same though more so will happen again later

How to grep (search) committed code in the Git history

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-25 23:14:14
问题 I have deleted a file or some code in a file sometime in the past. Can I grep in the content (not in the commit messages)? A very poor solution is to grep the log: git log -p | grep <pattern> However, this doesn\'t return the commit hash straight away. I played around with git grep to no avail. 回答1: To search for commit content (i.e., actual lines of source, as opposed to commit messages and the like), you need to do: git grep <regexp> $(git rev-list --all) git rev-list --all | xargs git grep

How do I view &#39;git diff&#39; output with my preferred diff tool/ viewer?

拈花ヽ惹草 提交于 2019-11-25 22:33:00
问题 When I type git diff , I want to view the output with my visual diff tool of choice (SourceGear \"diffmerge\" on Windows). How do I configure git to do this? 回答1: Since Git1.6.3, you can use the git difftool script : see my answer below. May be this article will help you. Here are the best parts: There are two different ways to specify an external diff tool. The first is the method you used, by setting the GIT_EXTERNAL_DIFF variable. However, the variable is supposed to point to the full path