개발아 담하자

[iOS/Swift] .gitignore 파일 간단하게 추가하기 본문

📱 iOS

[iOS/Swift] .gitignore 파일 간단하게 추가하기

choidam 2020. 3. 3. 12:09

git repository 에 프로젝트를 업로드 하기 전에 .gitignore 파일을 추가해야 이런 저런 충돌을 미리 예방할 수 있다.

🌟 프로젝트 업로드 이전에 🌟 반드시 .gitignore 을 추가하자❗️

 

1. https://gitignore.io

 

gitignore.io

Create useful .gitignore files for your project

www.gitignore.io

위 사이트에서 원하는 키워드를 입력한다.

swift, xcode, cocoapods 키워드를 추천한다.

키워드를 입력하고 검색하면 아래와 같은 파일이 생성된다.

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

### CocoaPods ###
## CocoaPods GitIgnore Template

# CocoaPods - Only use to conserve bandwidth / Save time on Pushing
#           - Also handy if you have a large number of dependant pods
#           - AS PER https://guides.cocoapods.org/using/using-cocoapods.html NEVER IGNORE THE LOCK FILE
Pods/

### 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/
# Add this line if you want to avoid checking in Xcode SPM integration.
# .swiftpm/xcode

# 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

# Accio dependency management
Dependencies/
.accio/

# 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/

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

## User settings

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)

## Xcode Patch
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno

### Xcode Patch ###
**/xcshareddata/WorkspaceSettings.xcsettings

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

위 내용을 복사를 해둔다!

 

 

2. terminal 창에 git repository 디렉토리로 간다.

3. vim .gitignore 명령어를 입력한다.

 

4. i 명령어를 입력한다 (INSERT)

5. 아까 복사해둔 내용을 붙여넣는다.

6. esc 버튼을 누른 후 :wq! 명령어를 입력한 후 엔터를 누른다.

7. git 에 push!!

 

 

 

정말 간단하다 🤩🤩