文章为转载学习,原文地址

为什么要配置.gitigore

在我们使用git的过程当中,不是任何文件都需要commit到本地或者远程仓库的,比如一些三方库文件。

那么作为一个git新手,很多人不知道如何配置.gitignore文件,本文只是提供一个便捷的例子。你可以直接使用本文提供的代码编辑到你的.gitigore文件中。

简便配置

直接复制下面的内容到你的.gitignore文件即可。注意,这个配置是给iOS开发者使用的。

# Xcode
.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.xccheckout
*.xcworkspace
!default.xcworkspace

#CocoaPods
Pods
!Podfile
!Podfile.lock

到gitignore.io去选择自定义配置

gitignore.io 输入你需要配置的语言,会帮助你自动生成一份配置。比如,输入Objective-C和Swift会帮助你生成下面的配置。

# Created by https://www.gitignore.io/api/objective-c,swift

### Objective-C ###
# 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
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa

# 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/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://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/screenshots

### Objective-C Patch ###
*.xcscmblueprint

### 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
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa

## 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/
.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/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://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

这个配置自动生成了很多注释和一些不太必要的配置,所以直接使用上面提供的简便配置就好。

iOS日常学习 - 如何配置.gitignore文件的更多相关文章

  1. 第四十四篇、iOS开发中git添加.gitignore文件

    .gitignore文件可以直接使用https://github.com/github/gitignore 1.在项目中设置忽略文件(1)将从github上荡下来的对应的.gitignore文件(Sw ...

  2. iOS日常学习 - App之间常用的五种通信方式及适用场景总结

    本文为转载学习,原文地址 iOS系统是相对封闭的系统,App各自在各自的沙盒(sandbox)中运行,每个App都只能读取iPhone上iOS系统为该应用程序程序创建的文件夹AppData下的内容,不 ...

  3. iOS日常学习 - 每个Xcode开发者应该知道的七个使用技巧

    本文为转载学习使用原文链接 工欲善其事,必先利其器.对一个iOS开发者来说,这就意味着对Xcode的熟练掌握程度.Xcode是一个学习起来有点难度的软件,下面的这些技巧或许可以显著的提高你的编程效率. ...

  4. 【转】 iOS日常学习 - iOS10上关于NSPhotoLibraryUsageDescription等问题

    原文网址:http://blog.csdn.net/wang631106979/article/details/52578001 最近升级了Xcode8.0,真是很多坑啊,填完一个来另外一个,今天又遇 ...

  5. iOS日常学习 - iOS10上关于NSPhotoLibraryUsageDescription等问题

    最近升级了Xcode8.0,真是很多坑啊,填完一个来另外一个,今天又遇到了一个,用Xcode8.0上传项目时被驳回说是info.plist里面没有设置NSPhotoLibraryUsageDescri ...

  6. iOS日常学习 - 让你的 Xcode8 继续使用插件

    本文转载,原文链接 随着 iOS10 的正式版即将发布,Xcode8 GM 也在发布会后放出,本文不会涉及到 Xcode8 有哪些更新,而是记录了如何让 Xcode8 继续支持 Plugin. 相信各 ...

  7. ios网络学习------10 原生API文件上传

    使用原生态的api上传文件的实现: #import "MainViewController.h" @interface MainViewController () @propert ...

  8. ios网络学习------11 原生API文件上传之断点续传思路

    watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvaHVhbmcyMDA5MzAzNTEz/font/5a6L5L2T/fontsize/400/fill/I0 ...

  9. $git学习总结系列(4)——gitignore文件

    有时候工作区中会有我们创建的一些密码配置文件,或者自动生成的一些临时文件,比如python代码编译产生的.pyc文件和java代码编译产生的.class文件等,我们在提交代码的时候没有必要把这些文件也 ...

随机推荐

  1. About LabView

    Recently I am running an experiment. Because the lab has only NI devices, I have to learn to use the ...

  2. vue-router路由懒加载

    正常配置 import Vue from 'vue' import Router from 'vue-router' import Login from '@/components/pages/log ...

  3. python基础-第七篇-7.4异常处理

    异常基础: 异常处理首先要捕获异常,不让程序中断,也不让错误信息直接呈现出来,然后就是你该怎么处理异常,以什么方式显示 try: pass except Exception,ex: pass 在需要用 ...

  4. SpringCloud 入门

    1. 入门概述 SpringBoot专注于快速方便的开发单个个体微服务; SpringCloud:关注全局的微服务协调治理框架,它将SpringBoot开发的一个个单体微服务整合并管理起来, 为各个微 ...

  5. app-framework学习--Scroller

    Scroller 这个插件同意你创建一个可滚动区域.我们使用的JavaScript滚轮,除非该设备支持 - WebKit的溢出卷轴:触摸.它有很多修复Android版<3和iOS原生的滚动. 创 ...

  6. Unity3D优化技巧系列七

    笔者介绍:姜雪伟,IT公司技术合伙人.IT高级讲师,CSDN社区专家,特邀编辑.畅销书作者,国家专利发明人;已出版书籍:<手把手教你架构3D游戏引擎>电子工业出版社和<Unity3D ...

  7. android 知识收集

    1.无论是 Activity.BroadcastReceiver还是Service,只要是有长时间处理的任务,就需要重新开一个线程来处理,为什么会这样? 因为他们都是运行在主线程中的. 2.在使用Br ...

  8. 为什么使用Sails?

    http://sailsdoc.swift.ren/ 这里有 sails中文文档 http://www.jianshu.com/p/ac2da4142259 前言 入手Node.js半年,从用Expr ...

  9. 【spring学习】中文乱码问题

    问题: 在这样的一个控制器中: 返回字符串中文部分全是问号. 解决方案: 在spring-mvc.xml文件中加入以下代码: <!-- 支持spring3.0新的mvc注解 ,解决json中的中 ...

  10. Selenium+Python学习之一

    刚入门selenium+Python,实验成功之后,记录一下过程. 首先是在知乎上面看到一个关于selenium+python的示例,于是自己便尝试搭建环境上手实验. 按照作者的代码敲一遍之后执行,竟 ...