본문 바로가기

iOS

[XCode/iOS] macos, swift 용 .gitignore 생성방법

XCode iOS용 .gitignore 작성 방법

 

- 모든 작업은 terminal 에서 진행

- git이 설치되어 있음

- .git repository를 프로젝트에 생성해 놓음

 

1. gitignore 생성관련 git config 환경설정(git 설치 후 최초 1회만 진행)

 

 $ git config --global alias.ignore '!gi() { curl -L -s https://www.gitignore.io/api$@; }; gi'

 

 

2. gitignore를 추가할 프로젝트 경로로 이동

 

3. www.gitignore.io 에 등록된 gitignore 생성 (사용할 언어에 대한 ignore 다수 지정 가능 : 빨간색으로 표시)

 

 $ git ignore swift,macos > .gitignore

 

 

4. 생성한 gitignore 커밋

 

 $ git add .gitignore

 

 $ git commit -m "Add .gitignore file"

 

 

프로젝트를 열면 아래와 같은 .gitignore가 적용되어 있음.

 

 


# Created by https://www.gitignore.io/api/swift,macos
# Edit at https://www.gitignore.io/?templates=swift,macos

### macOS ###
# General
.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
.com.apple.timemachine.donotpresent

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

### Swift ###
# 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/
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

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

Carthage/Build

# 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/**/*.png
fastlane/test_output

# Code Injection
# After new code Injection tools there's a generated folder /iOSInjectionProject
https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

# End of https://www.gitignore.io/api/swift,macos

 

 

끝.