Skip to content

Instantly share code, notes, and snippets.

@philosopherdog
Last active March 7, 2019 04:19
Show Gist options
  • Save philosopherdog/12510ce9e8c9a9aaf4bf30fee3249f39 to your computer and use it in GitHub Desktop.
Save philosopherdog/12510ce9e8c9a9aaf4bf30fee3249f39 to your computer and use it in GitHub Desktop.
setup gitignore_global for Xcode
# 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
*.moved-aside
*.xccheckout
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
.build/
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://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/
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control
fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output
# OS X temporary files that should never be committed
.DS_Store
*.swp
*.lock
*.xcworkspace/xcshareddata/
@philosopherdog
Copy link
Author

philosopherdog commented Apr 22, 2016

Installing .gitignore_global

  • create a hidden file called .gitignore_global in your the root of your user folder (if it doesn't exist) using the terminal, like this:

      touch .gitignore_global
    
  • open .gitignore_global in a text editor.

  • copy the above script into .gitignore_global and save the file.

  • setup your .gitconfig file to use this file by running the following command:

    git config --global core.excludesfile ~/.gitignore_global
    
  • your global gitignore file should now apply to all new repos you create.

  • if you have an existing repo run the following commands to force it to comply with this global gitignore file:

    git rm -r --cached .
    
  • You will have to add and commit all files after deleting the cache.

  • Note if you're working with others always use a local gitignore file on your repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment