diff

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

妖精的绣舞 提交于 2019-11-27 17:28:54
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 Sylvain Defresne A patch created with git format-patch will also include some meta-information about the commit (committer, date, commit message, ...) and will

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

可紊 提交于 2019-11-27 17:16:41
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 file You get my drift. Now, I know I can use other engines to mark/check the difference on a specific

How to perform case insensitive diff in Git

走远了吗. 提交于 2019-11-27 17:16:04
问题 git diff does not support a case-insensitive comparison of files. Google shows a very few people asking for that feature, and that too only in combination with some other git diff switch, like with -G or with --color-words . I don't care for other switches, as long as git diff can show me the case-insensitive diff. Since I didn't see any specific question towards that, and since I found a solution after an hour researching this problem, I am adding this question and the answer. 回答1: The

Highlight changed lines and changed bytes in each changed line

房东的猫 提交于 2019-11-27 17:14:18
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)? Sina Samavati 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.githubusercontent.com/git/git/fd99e2bda0ca6a361ef03c04d6d7fdc7a9c40b78/contrib/diff-highlight/diff

How can you diff two pipelines in Bash?

女生的网名这么多〃 提交于 2019-11-27 16:49:06
How can you diff two pipelines without using temporary files in Bash? Say you have two command pipelines: foo | bar baz | quux And you want to find the diff in their outputs. One solution would obviously be to: foo | bar > /tmp/a baz | quux > /tmp/b diff /tmp/a /tmp/b Is it possible to do so without the use of temporary files in Bash? You can get rid of one temporary file by piping in one of the pipelines to diff: foo | bar > /tmp/a baz | quux | diff /tmp/a - But you can't pipe both pipelines into diff simultaneously (not in any obvious manner, at least). Is there some clever trick involving

git diff - handling long lines?

社会主义新天地 提交于 2019-11-27 16:46:13
I'm running git-diff on a file, but the change is at the end of a long line. If I use cursor keys to move right it loses colour coding and worse the lines don't line up, making it harder to track the change. Is there a way to prevent that problem, or to simply make the lines wrap instead? (running git 1.5.5 via mingw32) SpoonMeiser The display of the output of git diff is handled by whatever pager you are using. Commonly, under Linux, less would be used. You can tell git to use a different pager by setting the GIT_PAGER environment variable. If you don't mind about paging (for example, your

Detect differences between tree structures

无人久伴 提交于 2019-11-27 16:43:41
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 being root A with child B to root B with child A etc.). In such cases, the algorithm would simply

Git file permissions on Windows

☆樱花仙子☆ 提交于 2019-11-27 16:38:49
I've read through a few questions regarding file permissions in Git and I'm still a bit confused. I've got a repo on GitHub forked from another. Post merge, they should be identical. However: $ git diff --summary origin/epsilon master/epsilon mode change 100644 => 100755 ants/dist/sample_bots/csharp/compile.sh mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/MyBot.coffee mode change 100644 => 100755 ants/dist/starter_bots/coffeescript/ants.coffee mode change 100644 => 100755 ants/util/block_test.sh mode change 100644 => 100755 manager/mass_skill_update.py mode change 100644 =>

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

混江龙づ霸主 提交于 2019-11-27 16:36:58
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) with git as I do with text files. How would I do this, e.g. when issuing git diff ? na_ka_na We faced

How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?

自古美人都是妖i 提交于 2019-11-27 16:36:26
I have a .diff file created by a coworker, and would like to apply the changes listed in that diff file to my local branch of the exact same repository. I do not have access to that worker's pc or branch that was used to generate this diff file. Obviously I could go line by line and retype everything, but i'd rather not subject the system to human error. What's the easiest way to do this? Philipp Copy the diff file to the root of your repository, and then do: git apply yourcoworkers.diff More information about the apply command is available on its man page . By the way: A better way to