5

I am using SourceTree as a git client.

A while ago, I had a major problem with my project and my git, so I had to reactivate a copy of my workspace from an external source. For that purpose I had created a complete new repository. Commiting to that now.

Today I've noticed, that most of my files appear as "modified" in Xcode. Even after commit and push (with SourceTree).

enter image description here

Source Control shows my two branches, what is correct:

enter image description here

And the History shows perfectly all the commits:

enter image description here

My feeling tells me, that in the background the old repository information is still present and does this bug. How do I handle this? Help is very appreciated.

Edit:

git diff --ws-error-highlight=new,old Output

enter image description here

David Seek
  • 16,783
  • 19
  • 105
  • 136

3 Answers3

5

Close Xcode. If you can avoid it, don't reopen Xcode :-) If it's an absolute must, reopen Xcode. The M markers should be gone.

Andy Weinstein
  • 2,639
  • 3
  • 21
  • 32
4

This worked for me:

  1. Delete derived data folder(Steps: Click Xcode on top left -> Preferences -> Locations -> Click on the right arrow below Derived Data and that will you take you to the Derived Data folder in Finder. Delete it)
  2. Quit Xcode (Don't just close the project)
  3. Reopen Xcode
Deveesh
  • 119
  • 2
2

Check if the nature of the diff is related to eol (end of lines).
See "git diff - show me line ending changes?", like:

 git diff --ws-error-highlight=new,old     

If that is the case, try first:

 git config --global core.autocrlf false

Then try again to clone your repo, and see if XCode still display those differences.

In your case, this is not about eol, but about an update done in your files.

Check for any .gitattributes file: is there a smudge directive in those files (which would explain an automatic process taking place on checkout)

See Keyword expansion for an example of smudge script.

Something seems to update JTAppleCalendar to its latest relase (6.0.1 from 7 days ago)

My feeling tells me, that in the background the old repository information is still present and does this bug.

Simply try, in command-line, to clone again that repo (in a brand new local path) and check if the issue persists in that new cloned repo.

to the JTAppleCalendar, I have changed from 6.0.0 to 6.0.1 manually. around 7 days ago. when the new xcode 8.0.1 arrived

In that case, all those files should be listed as modified: that is what Git does.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • @DavidSeek In command line, see http://stackoverflow.com/a/36604948/6309 – VonC Nov 04 '16 at 00:34
  • okay thank you. will try. to the `JTAppleCalendar`, I have changed from 6.0.0 to 6.0.1 manually. around 7 days ago. when the new xcode 8.0.1 arrived – David Seek Nov 04 '16 at 00:55
  • I can't find a `gitattributes` files within my project folder – David Seek Nov 04 '16 at 00:56
  • trying to clone into a new local path now – David Seek Nov 04 '16 at 00:58
  • I have cloned the branch into a new path by `sudo git clone -b development link /downloads` . i have opened the project in xcode and no file, but the one i'm editing for a test shows as modified... any suggestions? – David Seek Nov 04 '16 at 01:23
  • @DavidSeek is that the case for any file you edit through XCode? What if you edit it (just for testing) in any other editor? – VonC Nov 04 '16 at 01:40
  • the M appears in all the files I have edited since I had reactivated the local backup and pushed it into a new remote repository. – David Seek Nov 04 '16 at 01:44
  • NO! If I edit a test file with a regular editor, there is an M in xcode and then push the changes to the remote, the M disappears. – David Seek Nov 04 '16 at 01:46
  • but the M only disappears for that one file I have test edited in another editor – David Seek Nov 04 '16 at 01:46
  • @Dav OK, that seems expected: if you modify one file, it should appear modified indeed. The actual test was to make sure there is no multiple files modified even though you did not touch them – VonC Nov 04 '16 at 01:50
  • but why does the M disappear when i commit? but doesnt for the files i've edited within xcode? – David Seek Nov 04 '16 at 01:51
  • @Dav that is also expected: the modified status is associated to a difference between your current file and the index. Once you commit the change, both your file and the index are again identical. Until the next change. – VonC Nov 04 '16 at 01:54
  • well. yeah. i get that. but i would love that for the other files in my project as well xD – David Seek Nov 04 '16 at 01:55
  • @Dav all you need to do is modify those other files, and you should see the same M modified status in XCode. – VonC Nov 04 '16 at 01:57
  • well. the problem is, that I have like 40-50 Ms and they won't disappear after commit. even if i'm editing them. – David Seek Nov 04 '16 at 01:58
  • @Dav even in the new cloned repo? – VonC Nov 04 '16 at 02:02
  • no. i have just tried changes in the cloned repo. mitted them (within xcode source control) and the Ms disappeared. (i have also pushed it within xcode) (instead of my usual SourceTree) – David Seek Nov 04 '16 at 02:07
  • @Dav OK then: the suggestion of a new cloned repo seems to be a good one :) – VonC Nov 04 '16 at 02:08
  • okay. then I will follow that. would you recommend commiting and pushing with Xcode instead of SourceTree? or keep using SourceTree? – David Seek Nov 04 '16 at 02:09
  • @Dav in that new cloned repo, you should be able to use any one of them: the results would be the same. – VonC Nov 04 '16 at 02:11