iOS 配置ignore 文件

当我们将代码通过 git 上传的时候,不需要将多余的内容上传.
$ vim .gitignore,创建 ignore 文件,将一下内容写入以后, esc -> : ->x,保存项目的文件夹下即可.

# 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
 

github 上对于 OC 的忽略文件

# 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

Mac系统中,针对不同的语言设置 .gitignore 文件

上面的都是针对 OC 的配置文件,对于不同的语言:

  • 我们可以自己在 github 创建一个空项目,然后选择对应的 license ,和项目语言相应的忽略文件;
  • 将 github 的项目clone 到本地,打开本地的存储文件夹
    $ cd ~/Desktop/Test
    $ git clone < github 的项目地址>
  • 使用 Finder 打开项目文件夹,cmd+shift+.,显示当前目录的隐藏文件
  • 将其中的 .gitignore 隐藏文件复制到我们需要的地方
  • 然后 $ git status 查看有没有相应的问题

你可能感兴趣的:(iOS 配置ignore 文件)