Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which Xcode project files can I 'exclude' from my git repo?

Tags:

git

xcode

I'm working on an iOS project and am using git to do version control. I'm working on this with another developer.

Which Xcode project files should I keep in the repo and which ones can I exclude so that it doesn't affect the other developer negatively?

Here are some of the non-code files that git is telling me has been modified or added... (BTW, these are only viewable in the OSX file manager if you "Show Package Contents" for YourProject.xcodeproj file)

exclude ?

  • contents.xcwordspacedata (I think this is just workspace settings)
  • UserInterfaceState.xcuserstate (based on the name it seems only specific to me)
  • Breakpoints.xcbkptlist (...my breakpoints settings)

INCLUDE ?

  • project.pbxproj (INCLUDE...project settings)
  • *.xscheme (INCLUDE...scheme definitions)
  • xschememanagement.plist (INCLUDE...scheme manager settings?)

Does this seem right?

(Just an FYI for those that want to use the exclude feature of git. Edit your .git/info/exclude file in your local repository. Put in the files or the patterns for files that you want git to ignore. For example, if you want git to ignore foo.temp, bar.temp you can put a line in the file that says *.temp)

like image 791
milesmeow Avatar asked Dec 25 '11 06:12

milesmeow


People also ask

How do I ignore files in Xcode Git?

Fortunately the site gitignore.io has solved this problem for you. Go to gitignore.io, enter Xcode in the search field, and click the Create button. You will get a git ignore file with a list of file types that git should ignore. Add the git ignore file to your project folder.

How do I exclude files from a Git repository?

If you want to ignore a file that you've committed in the past, you'll need to delete the file from your repository and then add a .gitignore rule for it. Using the --cached option with git rm means that the file will be deleted from your repository, but will remain in your working directory as an ignored file.

What files should not be stored in Git?

You shouldn't store credentials like usernames, passwords, API keys and API secrets. If someone else steals your credentials, they can do nasty things with it.


1 Answers

Think this is a great place to start Xcode .gitignore

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata

## Other
*.xccheckout
*.moved-aside
*.xcuserstate

This one I modified Xcode .gitignore I believe it to be more comprehensive.

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata

## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# http://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-    pods-directory-into-source-control
#
#Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage    dependencies.
# Carthage/Checkouts

Carthage/Build

.DS_Store
.AppleDouble
.LSOverride

 # Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

The above adds CocoaPods, Carthage and some others that have shown up over time.

like image 82
Kincade71 Avatar answered Sep 16 '22 14:09

Kincade71