I WROTE THIS
git diff B.txt
OUTPUT
diff --git a/B.txt b/B.txt index 3bcc974..7be6bf0 100644 Binary files a/B.txt and b/B.txt differ
BUT ME i want to see the content about the changes could help me
CodePudding user response:
Git has identified that file as binary files rather than text, probably because it contains some unexpected control characters. You can use the -a
(--text
) option to git diff
to force git
to treat the files as text:
git diff -a B.txt
CodePudding user response:
The problem here is that Git has looked in the file B.txt
and decided that it is not a text file, but a "binary file". This could be because it contains a character that is not "text", or perhaps it has very long lines.
Git has to guess if the file is text or not (it can't tell by looking at the .txt
in its name). For binary files (such as image files), git will just print a message to say if the file is the same or different, rather than show you the differences.
Probably B.txt
has an extended character that is not in ASCII or UTF-8.
You can tell git
that this is in fact a text file by creating a file named .gitattributes
(this file's name must start with a period) in your project's main directory, with following content:
*.txt diff
Then typing git diff B.txt
should print the actual difference out, because git will treat files ending in .txt
as files that can be diff
erenced, no matter what they actually contain.
I suspect you might be using non-UTF8 for most of your files, so that you will need to add other file extensions to this list. Here's an example:
*.java diff
*.js diff
*.pl diff
*.txt diff
*.ts diff
*.html diff
*.sh diff
*.xml diff