개발

ios gitignore setting

진언한 2021. 4. 12. 13:48

Pods 로 파일을 추가하게 되면 커서 깃레포에 못 올라가는 경우가 발생했다.

그 이외에도 깃레포에 올릴 필요가 없는 파일들이 있다.

ignore 파일을 추가해서 올리지 않을 파일을 설정할 수 있다.

 

ignore 파일을 사용하지 않고 하던 중이라면 git repository 에 올라가 있는 Pods 파일 삭제해주고

ignore 파일을 추가한 이후에 푸시하면 된다.

.gitignore -> references 1 에서 git 사이트를 활용해서 생성하는 방법도 있다.

# Created by https://www.gitignore.io/api/swift,xcode,cocoapods

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

# CocoaPods - Only use to conserve bandwidth / Save time on Pushing
#           - Also handy if you have a lage number of dependant pods
#           - AS PER https://guides.cocoapods.org/using/using-cocoapods.html NEVER IGONRE 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
.build/

# CocoaPods - Refactored to standalone file

# Carthage - Refactored to standalone file

# 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

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

## Build generated

## Various settings

## Other

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

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

git repository 에 올라가 있는 Pods 파일 삭제

git rm -r --cache Pods/

 

그런데 이미 add, commit 을 한 상태로 push를 하려다 파일크기가 커서 못 올라간 경우나 되돌리고 싶으면 아래 명령어를 활용하면 된다.

References 2 에 친절하고 자세하게 사용법이 나와있다.

add 취소

git reset HEAD

commit 취소

git reset HEAD^ 	// 1 커밋 전
git reset HEAD~2 	// 2 커밋 전
// 기본 옵션은 --mixed, 소스까지 되돌리고 싶은 경우 --hard 옵션 사용: git reset [option] HEAD

로그 확인

git log

 

References

medium.com/@dohyeon/ios-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8%EB%A5%BC-%EC%9C%84%ED%95%9C-gitignore-%EC%84%A4%EC%A0%95-62856d179473

 

Medium

 

medium.com

gmlwjd9405.github.io/2018/05/25/git-add-cancle.html

 

[Git] git add 취소하기, git commit 취소하기, git push 취소하기 - Heee's Development Blog

Step by step goes a long way.

gmlwjd9405.github.io

stackoverflow.com/questions/34230191/added-pod-files-and-pushed-how-to-undo-how-to-use-gitignore-in-xcode-github

 

Added pod files and pushed. How to undo? how to use gitignore in Xcode & github?

This is a two part question: 1) I have added committed and pushed all pod files to github. Is there a way I can remove them and not push them again to github? 2) I know gitignore can help, but I d...

stackoverflow.com

 

728x90
반응형