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

为什么要配置.gitigore

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

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

简便配置

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

  1. # Xcode
  2. .DS_Store
  3. */build/*
  4. *.pbxuser
  5. !default.pbxuser
  6. *.mode1v3
  7. !default.mode1v3
  8. *.mode2v3
  9. !default.mode2v3
  10. *.perspectivev3
  11. !default.perspectivev3
  12. xcuserdata
  13. profile
  14. *.moved-aside
  15. DerivedData
  16. .idea/
  17. *.hmap
  18. *.xccheckout
  19. *.xcworkspace
  20. !default.xcworkspace
  21. #CocoaPods
  22. Pods
  23. !Podfile
  24. !Podfile.lock

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

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

  1. # Created by https://www.gitignore.io/api/objective-c,swift
  2. ### Objective-C ###
  3. # Xcode
  4. #
  5. # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
  6. ## Build generated
  7. build/
  8. DerivedData/
  9. ## Various settings
  10. *.pbxuser
  11. !default.pbxuser
  12. *.mode1v3
  13. !default.mode1v3
  14. *.mode2v3
  15. !default.mode2v3
  16. *.perspectivev3
  17. !default.perspectivev3
  18. xcuserdata/
  19. ## Other
  20. *.moved-aside
  21. *.xcuserstate
  22. ## Obj-C/Swift specific
  23. *.hmap
  24. *.ipa
  25. # CocoaPods
  26. #
  27. # We recommend against adding the Pods directory to your .gitignore. However
  28. # you should judge for yourself, the pros and cons are mentioned at:
  29. # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
  30. #
  31. # Pods/
  32. # Carthage
  33. #
  34. # Add this line if you want to avoid checking in source code from Carthage dependencies.
  35. # Carthage/Checkouts
  36. Carthage/Build
  37. # fastlane
  38. #
  39. # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
  40. # screenshots whenever they are needed.
  41. # For more information about the recommended setup visit:
  42. # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
  43. fastlane/report.xml
  44. fastlane/screenshots
  45. ### Objective-C Patch ###
  46. *.xcscmblueprint
  47. ### Swift ###
  48. # Xcode
  49. #
  50. # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
  51. ## Build generated
  52. build/
  53. DerivedData/
  54. ## Various settings
  55. *.pbxuser
  56. !default.pbxuser
  57. *.mode1v3
  58. !default.mode1v3
  59. *.mode2v3
  60. !default.mode2v3
  61. *.perspectivev3
  62. !default.perspectivev3
  63. xcuserdata/
  64. ## Other
  65. *.moved-aside
  66. *.xcuserstate
  67. ## Obj-C/Swift specific
  68. *.hmap
  69. *.ipa
  70. ## Playgrounds
  71. timeline.xctimeline
  72. playground.xcworkspace
  73. # Swift Package Manager
  74. #
  75. # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
  76. # Packages/
  77. .build/
  78. # CocoaPods
  79. #
  80. # We recommend against adding the Pods directory to your .gitignore. However
  81. # you should judge for yourself, the pros and cons are mentioned at:
  82. # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
  83. #
  84. # Pods/
  85. # Carthage
  86. #
  87. # Add this line if you want to avoid checking in source code from Carthage dependencies.
  88. # Carthage/Checkouts
  89. Carthage/Build
  90. # fastlane
  91. #
  92. # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
  93. # screenshots whenever they are needed.
  94. # For more information about the recommended setup visit:
  95. # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
  96. fastlane/report.xml
  97. fastlane/Preview.html
  98. fastlane/screenshots
  99. 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. good blog

    https://blog.csdn.net/fgf00/article/details/52793739

  2. c++主程这种事情,就是这样,看人先看人品,没人品,他的能力与你何关?

    这就是人品的重要性........ 接手别人的代码,说困难,也困难,说容易也容易 想把别人代码都读通,理顺,在改原代码BUG,在完美的加功能,那项目越大,越难 想把别人代码里面,加点坑,随便找个模块, ...

  3. linux下的KSM内存共享机制分析

    2017-04-26 KSM是内核中的一种内存共享机制,在2.6.36版本的内核中开始引入,简单来说就是其会 合并某些相同的页面以减少页面冗余.在内核中有一个KSM守护进程 ksmd,它定期扫描用户向 ...

  4. jquery prop attr

    checked比较特殊,只要设置了属性checked,不管何值都是checked的.例如:<input type="checkbox" checked><inpu ...

  5. MyEclipse 10的使用技巧

    默认快捷键 :Shift+Alt+s 然后选择generater getter and setter,这是快捷键.或者右键source里边有 generater getter and setter. ...

  6. 创建正真的Java不可变类

    如果需要设计一个不可变类,尤其要注意其引用类型Field,如果其引用类型Field的类是可变的,就必须采取必要的措施来保护该Field所引用的对象不会被修改,这样才能创建真正的不可变类. class ...

  7. Linux 超级用户和普通用户切换命令

    默认登录的是普通用户权限显示$符 tree@ubuntu:/usr$ 从普通用户切换超级用户权限: sudo su tree@ubuntu:/usr$ sudo su 输入密码 [sudo] pass ...

  8. Linux系统——文件和目录权限

    文件及目录权限(七进制表示) r  读权限(4),允许查看文件内容 w 写权限(2),允许修改文件内容 x  可执行权限(1),允许运行程序 - 无权限(0) 属主:拥有该文件的用户账号 属组:拥有该 ...

  9. PHP下使用Redis消息队列发布微博(复制)

    phpRedisAdmin :github地址  图形化管理界面 git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git cd ph ...

  10. PKU 4334 Trouble(哈希)

    原题链接 思路:哈希存入相反数 注意:HDU不支持long long要使用__int64 #include<cstdio> #include<cstring> #define ...