diff

Diffing between two entire directories/projects in hg or git?

筅森魡賤 提交于 2019-11-26 19:14:14
问题 I inherited a project originally stored in CVS with all the revisions. I made quite a few edits, and I'm trying to compare all the changes I made in the original directory, in regards to new files added versus the old ones. Is there some sort of utility for hg/git where I can do a tree diff, or something of that nature? So that say, there's a mark between newly added files, deleted files, am I asking for too much? 回答1: git diff does exactly that. but it only works for git projects. hg diff ,

Using jq or alternative command line tools to compare JSON files

断了今生、忘了曾经 提交于 2019-11-26 19:05:14
问题 Are there any command line utilities that can be used to find if two JSON files are identical with invariance to within-dictionary-key and within-list-element ordering? Could this be done with jq or some other equivalent tool? Examples: These two JSON files are identical A : { "People": ["John", "Bryan"], "City": "Boston", "State": "MA" } B : { "People": ["Bryan", "John"], "State": "MA", "City": "Boston" } but these two JSON files are different: A : { "People": ["John", "Bryan", "Carla"],

What is the difference between 'git format-patch and 'git diff'?

可紊 提交于 2019-11-26 19:00:32
问题 I don't see a difference between the output of 'git format-patch' and 'git diff', is there any? And won't I be able to use 'git diff' to produce a patch and then apply it using git apply? My problem is that I have changes added to the index, but apparently git format-patch only accepts commits, so if I can use the output of diff, then I can use this command to produce a patch for the changes in the index: git diff --cached > index.patch 回答1: A patch created with git format-patch will also

Using 'diff' (or anything else) to get character-level diff between text files

蹲街弑〆低调 提交于 2019-11-26 18:53:47
问题 I'd like to use 'diff' to get a both line difference between and character difference. For example, consider: File 1 abcde abc abcccd File 2 abcde ab abccc Using diff -u I get: @@ -1,3 +1,3 @@ abcde -abc -abcccd \ No newline at end of file +ab +abccc \ No newline at end of file However, it only shows me that were changes in these lines. What I'd like to see is something like: @@ -1,3 +1,3 @@ abcde -ab<ins>c</ins> -abccc<ins>d</ins> \ No newline at end of file +ab +abccc \ No newline at end of

Highlight changed lines and changed bytes in each changed line

与世无争的帅哥 提交于 2019-11-26 18:52:14
问题 Open Source project Trac has an excellent diff highlighter — it highlights changed lines and changed bytes in each changed line! See here or here for examples. Is there way to use the same color highlight (i.e. changed lines and changed bytes too ) in bash terminal, git , or vim for diff output (patch-file)? 回答1: The diff-highlight Perl contrib script produces output so similar to that of the Trac screenshots that it is likely that Trac is using it: Install with: wget https://raw

How do I create a readable diff of two spreadsheets using git diff?

吃可爱长大的小学妹 提交于 2019-11-26 18:45:42
问题 We have a lot of spreadsheets (xls) in our source code repository. These are usually edited with gnumeric or openoffice.org, and are mostly used to populate databases for unit testing with dbUnit. There are no easy ways of doing diffs on xls files that I know of, and this makes merging extremely tedious and error prone. I've tried to converting the spreadsheets to xml and doing a regular diff, but it really feels like it should be a last resort. I'd like to perform the diffing (and merging)

Detect differences between tree structures

僤鯓⒐⒋嵵緔 提交于 2019-11-26 18:44:27
问题 This is more of a CS question, but an interesting one : Let's say we have 2 tree structures with more or less the same nodes reorganized. How would you find any in some sense minimal sequence of operations MOVE(A, B) - moves node A under node B (with the whole subtree) INSERT(N, B) - inserts a new node N under node B DELETE (A) - deletes the node A (with the whole subtree) that transforms one tree to the other. There might obviously be cases where such transformation is not possible, trivial

How to apply `git diff` patch without Git installed?

馋奶兔 提交于 2019-11-26 18:42:26
问题 How can my client apply patch created by git diff without git installed? I have tried to use patch command but it always asks file name to patch. 回答1: git diff > patchfile and patch -p1 < patchfile work but as many people noticed in comments and other answers patch does not understand adds, deletes and renames. There is no option but git apply patchfile if you need handle file adds, deletes and renames. EDIT December 2015 Latest versions of patch command (2.7, released in September 2012)

How do I apply a diff patch on Windows?

久未见 提交于 2019-11-26 17:54:51
问题 There are plenty of programs out there that can create a diff patch, but I'm having a heck of a time trying to apply one. I'm trying to distribute a patch, and I got a question from a user about how to apply it. So I tried to figure it out on my own and found out that I have no clue, and most of the tools I can find are command-line. (I can handle a command line, but a lot of people would be lost without a nice, friendly GUI. So those are no good for this purpose.) I tried using TortoiseSVN.

Want to exclude file from “git diff”

馋奶兔 提交于 2019-11-26 17:53:53
问题 I am trying to exclude a file ( db/irrelevant.php ) from a Git diff. I have tried putting a file in the db subdirectory called .gitattributes with the line irrelevant.php -diff and I have also tried creating a file called .git/info/attributes containing db/irrelevant.php . In all cases, the db/irrelevant.php file is included in the diff as a Git binary patch. What I want is for the changes to that file to be ignore by the diff command. What am I doing wrong? 回答1: Omg, drivers and awk to