git and xcode - untracked files

1.2k views Asked by At

I started work on a new project and found I had the following when I launched Xcode:

Changes not staged for commit:

modified: <project>.xccheckout

and

Untracked files: 

<project>/xcshareddata/

I then edited .gitignore to ignore .xccheckout and checked the status. It now read as follows:

Changes not staged for commit:

modified: .gitignore
modified: <project>.xccheckout

i.e. the Untracked files mentioned previously were no longer being output by git. I've tried this several times and it's completely reproducible - but completely inexplicable.

1

There are 1 answers

0
ivan.sim On

Something to keep in mind about .gitignore is that files that are already tracked/added aren't affected by it. And it looks like your <project>.xccheckout is already git-versioned.

To trick git into assuming that thist file is committed but remain unchanged you can do:

git update-index --assume-unchanged path/to/<project>.xccheckout

To reverse:

git update-index --no-assume-unchanged path/to/<project>.xccheckout

As for <project>/xcshareddata/, I assume there are .xccheckout files in there that are untracked by git. Hence, after your .gitignore is introduced, git ignores all of them.