Source tree will not display the diff for only one file in my repo even though the file is changed and git status shows it as as changed

Angus Denton March 9, 2015

I have a project in a GIT repository which I manage through Source Tree. One file only has ceased to display a diff in the right hand pane even though it is shown as changed in the file/status tab and from the git command line. Instead the diff pane has the file name with a green icon with a tick in it. If I open the file and re-save it forcing UTF-8 (As there has been a reported bug about Unicode 16 files) with a text editor, the file is shown with a yellow icon with "Open before" and "Open after" buttons. I simply want source tree to display the diff information for this file again 

20 answers

11 votes
guneyozsan June 2, 2017

Increasing the max file size in Tools/Options/Diff/Internal Diff View should solve the issue.

Joachim Eibl October 8, 2018

Thanks. The initial "Size Limit (Text)" was 1024 KB. My file was twice that size.

Like # people like this
Abhijitmiku November 28, 2018

Thanks it worked for me :)

Like guneyozsan likes this
Daniel Ferreira January 10, 2019

Thanks @guneyozsan, this solve my problem!

4 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 17, 2015

Try fiddling with the "Internal Diff View" settings in Options > Diff.

2 votes
Andreas Hofer February 24, 2016

I had the same problem. In my case, I discovered that git thinks the file is a binary file. Somehow the encoding changed to Unicode. After I changed that back to Ansi it was ok again.

1 vote
deversity May 4, 2021

The reason I was getting no diff in SourceTree (or in Terminal using `git diff`) was because the file in question was added as a Git LFS file

Git (and SourceTree) do not seem to be able to diff text files added to LFS. However after a bit of hunting and I was able to fix this by running...
`git config --global diff.lfs.textconv cat`

with help from the suggestion here...
https://github.com/git-lfs/git-lfs/issues/440#issuecomment-501007460

(Note that adding and discard hunks in SourceTree is still broken even with this workaround)

1 vote
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 10, 2015

If the differences in a file are only whitespace, and you have the SourceTree diff panel set to ignore whitespace, it will be displayed exactly as you are describing.

Angus Denton March 11, 2015

Hi Seth; thanks for taking the time to respond

This file has undergone significant change in the text or code should I say. So it is not a white space issue.

cheers 

Gus

0 votes
Rod Dewell March 29, 2021

Another explanation for why you might receive the message "No changes in this file have been detected, or it is a binary file" is because the file is a unicode or UTF-16 encoded file.  Files with UTF-16 encoding are not recognized as text files by SourceTree (or specifically git diff).   As a result you cannot view the file or compare changes. 

If the file suffix of the UTF-16 files is known (*.uni for example) then all files with that suffix can be associated with UTF-16 to UTF-8 converter with the following two changes:

  1. Create or modify the .gitattributes file in the root directory of the repository with the following line:

     *.uni diff=utf16
  2. Then modify the .gitconfig file in the users home directory (C:\Users\yourusername\.gitconfig) with the following section:

    [diff=utf16]
        textconv = "iconv -f utf-16 -t utf-8"

These two changes should take effect immediately without reloading the repository into SourceTree. It applies the text conversion to all *.uni files which makes them viewable and comparable like other text files. If other files need this conversion you can add additional lines to the .gitattributes file. (If the designated file(s) are NOT UTF-16 you will get unreadable results for that file.)

This is a link to www.stackoverflow.com's answers to this question:  https://stackoverflow.com/questions/777949/can-i-make-git-recognize-a-utf-16-file-as-text

0 votes
Kevin O'Connell August 27, 2019

This issue seems to happen to any of my files who's paths contain spaces in them.

0 votes
Vinh Nguyen November 22, 2017

I encountered the same issue. SourceTree would not show up difference on the right pane. This just happens on specific file after we made some change to it.

It turned out that the file encoding was changed to UCS-2 Big Endian by mistake (previously UTF-8). Issue was resolved once we change it back to UTF-8.

SourceTree version 1.7.0.32509.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2016

@Aaron Lavers Not much I can help you with there, I'm just another user. If the git diff had the same issue, I'd help you figure what was wrong with your files. However, since the SourceTree diff doesn't match the git diff, I recommend filing a bug report at jira.atlassian.com. 

0 votes
Aaron Lavers January 27, 2016

@Seth  hey mate, when running through terminal the git process shows diffs as per usual, and in the Wakanda software I'm using it also displays the diffs correctly.
Part of me is wondering if that in itself is an issue - Wakanda performing it's own diffs, or even regenerating whole files (*though I'd still expect to just see one or two lines change).

It is unusual behaviour, though I am getting around it by viewing my diffs both on the github site as well as in the terminal. 

Is there any sourcetree logs I can drag up to share that might help? I'm a bit of a noob with the gui sorry.  

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 27, 2016

@Aaron Lavers - How does SourceTree's output compare to a git diff command?

0 votes
Aaron Lavers January 26, 2016

I have the same issue. Multiple lines edited on two files, file 1 highlights the first line (doctype declaration) in red as being deleted, the second file highlights all the changed lines as per normal. 

Both files have had the same lines edited, yet one shows the diff, the other just displays like the attached screenshot.

This has been an issue for several weeks now. 


Screen Shot 2016-01-27 at 2.52.16 pm.png

0 votes
Damon Overboe December 7, 2015

@Seth First I meant to say "sorry for posting to an old thread" too. I justified it by this just being a comment :) I did see the ellipses and even clicked on them. The only option given is to "Reverse File" which I know I didn't want, and there is no indication that the file is too large. I had a guess that might be it, and this post confirmed it. I'm not sure that this is worthy of a full-on feature request, but it would add some clarity for a known situation.

0 votes
Seth
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 4, 2015

@Damon Overboe It kinda does - there is a ellipses (...) at the bottom of the diff. I won't try and argue that it is noticable, or even particularly meaningful, but it is something. You could file a feature request at jira.atlassian.com if you think it should be more explicit.

0 votes
Damon Overboe December 4, 2015

@Seth What would be awesome is if the pane where the diffs/chunks used to show would now show a message that it's not displaying the chunks because you've exceeded the size limit. That would prevent users from thinking the file or local repo became corrupted.

0 votes
宇 托 October 4, 2015

I have the same issue.

0 votes
G Mann July 2, 2015

Nothing I changed in Options > Diff made any difference.

But what did was... Change from 'Tree View' to either of the 'Flat List' choices.

0 votes
John Muhlestein July 2, 2015

Seth, that fixed my problem, thanks.

0 votes
G Mann July 2, 2015

I have the same issue. Real content changes, not whitespace, small file 3kB. SourceTree will not start external diff (which otherwise works with multiple file changes). Problem is with SourceTree - using SourceTree's Terminal and the git diff command works fine

0 votes
John Muhlestein June 17, 2015

I experience the same issue. Just a single file in my repository, and other users of Source Tree also can not see the differences in the diff panel for the same file. I'm wondering if there is a size limitation of some kind. The file currently has 13,459 lines and 1,153,964 characters. Wildly inconvenient to not be able to see the change hunks, which means the features for only saving specific hunks do not work for this file either.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events