Sourctree reports modified files after clone

I'm having a problem where after I do a clone sourcetree is telling me that I have modified files even though I haven't yet edited any code. When diffing the code, the differences seem to be whitespace only. I'm pretty sure that the difference is related to line endings.

The files in questions are all of a type that have 'eol=crlf' set in .gitattributes.

What's confusing to me is that doing a 'git status' in the git bash does not report any modified files. Generally I'd believe that we might have some line ending issues in the repo, but I can't understand why sourcetree and the command line tools are treating the working area differently.

Any advice on how to resolve this issue? I've seen similar questions in here, but they seem to be regarding hg and not git.

2 answers

1 accepted

Hi Matthew,

There's probably another property set in your git config which is affecting what happens on checkout. For example the 'text' attribute has an effect on checkout and will normalise line-endings automatically. Have you got any 'text' or 'autocrlf' settings in your config?


autocrfl is true. But I still don't understand why the command line git and Sourcetree don't agree on the files status. Aren't they using the same config?

I cleaned out my area and redid my checkout. Now I can't reproduce my disagreement between the command line tools and sourcetree. I did do an upgrade when this showed up, could there have been some issue around a repo that was checked out with the old version?

Anyway, CRLF issues are definitely one of my problems, so I'm marking an answer regarding those issues.

It means these files were committed to the repo in a way which didn't perform the line ending conversion that your client setup would now do. They show as modified because you're being prompted to re-commit them, which will perform the line ending conversion as *currently* configured and resolve the issue.

see the comment to Kieran. What you say may be true, but command line git and sourcetree dont' agree on the file status.

What git command are you issuing? SourceTree just issues 'git status', with these options with the default filter:

git status --porcelain --ignore-submodules=dirty --untracked-files=all

As you say, it picks up all the same config as git on the command line because that's exactly what it's calling.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,236 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you