iOS实用功能

iOS SourceTree 添加忽略文件.gitignore

2020-06-18  本文已影响0人  水中的蓝天

本文源自本人的学习记录整理与理解,其中参考阅读了部分优秀的博客和书籍,尽量以通俗简单的语句转述。引用到的地方如有遗漏或未能一一列举原文出处还望见谅与指出,另文章内容如有不妥之处还望指教,万分感谢。

iOS 使用CocoaPods 集成第三方库,很容易提交一些不需要的代码到仓库,Xcode编译出来的临时文件这些也不需要提交,SourceTree 可以编辑全局忽略文件列表

进入 SourceTree 偏好设置 -> Git -> 全局忽略列表点击编辑文件

添加

*~ 

.DS_Store 

*.xcuserstate 

*.xcworkspace 

xcuserdata 

*.lock 

Pods

以上内容可以根据需求修改

添加了.gitignore 还需要把缓存清除一下才生效执行

git rm -r --cached .

git add .

git commit -a -m "清除缓存,gitignore起作用"

git push

更全的.gitignore

# OS X

.DS_Store

# Xcode

build/

*.pbxuser

!default.pbxuser

*.mode1v3

!default.mode1v3

*.mode2v3

!default.mode2v3

*.perspectivev3

!default.perspectivev3

xcuserdata/

*.xccheckout

profile

*.moved-aside

DerivedData

*.hmap

*.ipa

# Bundler

.bundle

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

# Carthage/Checkouts

Carthage/Build

# 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-ignore-the-pods-directory-in-source-control](https://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control)

#

# Note: if you ignore the Pods directory, make sure to uncomment

# `pod install` in .travis.yml

#

Pods/

Podfile.lock

上一篇下一篇

猜你喜欢

热点阅读