Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git not tracking a file from a folder - contents.json from .xcassets

I have checked almost all the questions on SO but nothing has worked for me. The issue that I'm unable commit the Contents.json file of .xcassets whatsoever. Whenever I add new images to .xcassets the source control does list the images but not the Contents.json file. I'm using a bitbucket repository and not even SourceTree is showing this file in the uncommitted changes. Even tried adding all the files via terminal.

git add --all

Any guess why this is happening and what could possibly be the solution?

Update: The .gitignore file looks like:

ProjectName.xcworkspace/xcuserdata
ProjectName.xcodeproj/xcuserdata
*.xcscheme
xcschememanagement.plist

And .git/info/exclude looks something like:

.DS_Store
UserInterfaceState.xcuserstate
like image 455
Adeel Miraj Avatar asked Jan 06 '17 06:01

Adeel Miraj


2 Answers

A lot of time has passed, but it seems I know what it is. I encountered the same problem, and every time I added resources, I had to manually do the following steps: git add -f

However, I found out about the command: git status --ignored The command shows all ignored files. After that, I made the git add -f command manually, and it worked.

like image 91
Azot Avatar answered Oct 16 '22 23:10

Azot


Probably you have .xcassets/Contents.json in one or more of the three ignore files .gitignore, .git/info/excludes and ~/.gitexclude.

If that is not the case then try executing below command which will ask Git to start tracking the file again:

git update-index --no-assume-unchanged <file>

For your case:

git update-index --no-assume-unchanged .xcassets/Contents.json
like image 42
Arpit Aggarwal Avatar answered Oct 17 '22 00:10

Arpit Aggarwal