码迷,mamicode.com
首页 > 其他好文 > 详细

gitignore的编写规则

时间:2018-02-24 17:55:38      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:gen   body   add   generate   fast   direct   screens   gui   void   

# 为注释符号,写在之后的东西将被 Git 忽略  

*.a       # 忽略所有 .a 结尾的文件  

!lib.a    # 但 lib.a 除外  

/TODO     # 仅仅忽略项目根目录下的 TODO 文件,不包括 sub dir/TODO  

build/    # 忽略 build/ 目录下的所有文件  

doc/*.txt # 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt

 

规则很简单,不做过多解释,但是有时候在项目开发过程中,突然心血来潮想把某些目录或文件加入忽略规则,按照上述方法定义后发现并未生效,原因是.gitignore只能忽略那些原来没有被track的文件,如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的。那么解决方法就是先把本地缓存删除(改变成未track状态),然后再提交:

git rm -r --cached .  

git add .  

git commit -m ‘update .gitignore‘

 

 

 

下面是在github上面创建项目的时候,选择的oc版本的ignore文件,我自己添加一个了忽略.DS_Store文件

 

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

.DS_Store

 

## Other

*.moved-aside

*.xccheckout

*.xcscmblueprint

 

## Obj-C/Swift specific

*.hmap

*.ipa

*.dSYM.zip

*.dSYM

 

# 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://docs.fastlane.tools/best-practices/source-control/#source-control

 

fastlane/report.xml

fastlane/Preview.html

fastlane/screenshots

fastlane/test_output

 

# Code Injection

#

# After new code Injection tools there‘s a generated folder /iOSInjectionProject

# https://github.com/johnno1962/injectionforxcode

gitignore的编写规则

标签:gen   body   add   generate   fast   direct   screens   gui   void   

原文地址:https://www.cnblogs.com/chebaodaren/p/8466885.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!