Xcode iOS using git

I installed the bitbucket repository and configured it in my Organizer. I created the base .gitignore and added it to the root of my project. I tried to transfer all the files, but it keeps saying that there are uncommitted files when I try to click.

Undefined files:

  • .DS_Store
  • project.pbxproj
  • UserInterfaceState.xcuserstate

I already installed * .xcuserstate in my .gitignore.

Any ideas?

+4
source share
4 answers

I had the same problem all the time.

Close Xcode first. This will continue to generate xcuserstate changes that will continue. Open your project folder, we need to get user status from it. If you right-click on the .xcodeproj file, select Show Package Contents. This will allow you to see everything that is hiding there. You can delete the .xcuserdata file. This may lose your Xcode state, for example, which folders you opened, tabs, etc. But this in no case should harm your project. It will just create another next time you open Xcode.

Then open a terminal. This is the best way to deal with this problem. Make sure that you are in the directory of your project inside the terminal. If you're not sure, type cd and drag the project folder into the terminal to load the location name.

 rm .DS_Store 

This will delete the hidden folder file created by Mac OS. Do not worry about it. Close the project folder if you do not already have one, or just create another one.

I hope that if you get to this, you can run git status in the terminal in this current setting and see a message showing only 1 file left to commit. Pbxproj file. If so, great!

 git add project.pbxproj git commit -m "Put some commit message for this file" 

This should add the project file and pass it to git and clear everything. The git status should indicate that your repo is free and free of all your unsolicited and uncommitted files.

If you're lucky when you run Xcode again and the files are created, your gitignore file should run and ignore them for future commits. This used to happen to me when I first started with git. I finally learned how to check the ignore file first before adding the Xcode source files. Hope this helps.

+2
source

It looks like you added these files to the repo before setting up your gitignore.

You will need to delete them completely first - check this message: Ignore files that have already been linked to the Git repository

I usually have the following:

 .DS_Store *.log xcuserdata build/* .svn 

Well, svn is just because there is some kind of version control going on and the build folder is not needed, as in Xcode 4.4, I believe this version stores assemblies in a different place, but you can override this if you want. Good to keep that.

project.pbxproj is actually your project file, you need it, although it will be annoying if you are on a team, as other developers change their code signing profiles in the project content: IOS team preparation profiles are your friend.

+1
source

You will need to delete the file from the repository and commit the deletion to the .gitignore file in order to start ignoring it. It will not ignore files that are already present.

+1
source

Here is my .gitignore file (don't ignore project.pbxproj):

 .bundle db/*.sqlite3 log/*.log tmp/ .DS_Store 
0
source

Source: https://habr.com/ru/post/1438990/


All Articles