Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git diff -cc mode won't be displayed by difftool

I'm not sure what's going on but I just set up my diff tool to be called by git difftool, yet the very first file difftool encounters is displayed in the standard diff manner - on the console with line-by line replacements

diff --cc path/to/file.c
index ac1b99f,da29e2e..0000000
--- a/path/to/file.c
+++ b/path/to/file.c
@@@ -186,18 -133,20 +188,18 @@@

   code code code code
   more code more code more code
-- old code old code old code [displayed in red]
++ new code new code new code [displayed in green]
   even more code even more code 
   yet more code yet more code

This seems to be a special case of a diff as it has the --cc flag and a triple @ symbol (@@@ ) instead of a double one (@@), and most importantly a strange description of the revisions being diffed : hash1,hash2..0000000.

What exactly is this ? I chose Beyond Compare as my diff tool, can it handle those cases ? If not, might another be able to do so ?

like image 886
Charles Avatar asked Mar 07 '19 10:03

Charles


People also ask

Why is git diff not showing anything?

Why do you get no git diff output before adding? Git does not treat files in the filesystem as automatically included in the version control system. You have to add things explicitly into the Git repository (as you are doing by adding the current directory with git add . ).

What is git Difftool?

git difftool is a Git command that allows you to compare and edit files between revisions using common diff tools. git difftool is a frontend to git diff and accepts the same options and arguments. See git-diff[1].

How do I see staged changes in git?

If your changes are already staged, then there's no difference to show. But there's a command line option that will show you staged changes if you specify it: git diff --staged . With the --staged option, git diff will compare your staged changes against the previous commit.

How do you find the difference between two branches?

How do I compare two different branches in my Git repository? Using git-diff you can compare two branches by viewing a diff between them, or you can use git-log to view a list of commits that comprise the difference between them. Compare two branches with git diff branch1.. branch2 .


1 Answers

Combined diffs are peculiar to Git and generally not available anywhere else.

Git doesn't know how to invoke other commands to have them produce combined diffs, even if some other command would be able to do it.

(Git describes how to read combined diffs in one section of the various git diff documentation, and leaves out a crucial fact: combined diffs usually omit most of the differences. This fact is mentioned elsewhere in the documentation, far from the part one studies when trying to understand how to read a Git combined diff. Anyway, combined diffs are only really good for inspecting the merge-y parts of merges.)

like image 69
torek Avatar answered Oct 26 '22 16:10

torek