1. Quit Xcode.
2. Open terminal and navigate to your directory. Using something like:
cd Developer/myprojectnameThere is a file in Xcode that we do not want to add to source control. This records the Xcode environment state. Because we're doing this adding manually, we have to tell Git manually to ignore it. If we had told Xcode to add the project to source control when we created the project it would have ignored this file automatically.
3. Type the find command to find the file file.
find .The file we are looking for is UserInterfaceState.xcuserstate
4. Place the file name into an exclude file.
echo myproject.xcodeproj/project.xcworkspace/xcuserdata/John.xcuserdatad/UserInterfaceState.xcuserstate >.gitignore
This will create the file gitignore
5. Initialise Git
git initDid you get an error? (See bottom of post)
6. Add the files
git add .
7. Commit the files to the repository
git commit -m "write a short comment here"
Problem with Git?
Are you getting the command not found?
bash: git: command not foundThis can be solved by:
- Open Xcode
- Open Preferences
- Chose the Downloads tab, choose components
- Instal the Command line tools.
Bob's your uncle.