记录一次给iOS 工程添加.gitignore文件

新建了一个iOS工程,修改过代码之后,提交发现有一些自己不想要提交的内容

如下图,里面有.DS_Store文件,还有xcsuserstate文件,

这个时候需要添加忽略文件

首先在工程文件夹中执行 touch .gitignore 创建忽略文件,如果创建过之后

看不到文件,则是没有展示隐藏文件,执行cmd + shift + .就可以看到了

然后编辑如下

复制代码
# 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

然后删除记录

复制代码
git rm -r --cached .

添加修改

复制代码
git rm -r --cached .

提交修改

复制代码
git commit -m "修改gitignore文件"

推到远端

复制代码
git push

会产生这样的一个删除提交

相关推荐
2501_9160074711 小时前
前端开发常用软件与工具全面指南
android·ios·小程序·https·uni-app·iphone·webview
超梦dasgg13 小时前
工作中 Git 完整使用指南(职场实战版)
git
Ws_13 小时前
Git + Gerrit 第七课:stash 临时保存工作区修改
git
enjoywindstorm14 小时前
git从入门到精通
git
sweet丶16 小时前
iOS AI 编程环境配置:Agent、Skill、Rules、Hook、Command
ios·ai编程
2501_9159090616 小时前
iOS应用性能优化:十大策略提升用户体验与开发效率
android·ios·小程序·https·uni-app·iphone·webview
Adorable老犀牛18 小时前
Git 发布正式版本的一个专属的硬核功能,叫做 打标签(Tag)。
git
我先去打把游戏先19 小时前
Ubuntu虚拟机(服务器版本)Git卸载完全教程——彻底移除与清理配置
服务器·git·单片机·嵌入式硬件·物联网·ubuntu·51单片机
白玉cfc19 小时前
【iOS】底层原理:分类、扩展和关联对象
ios·分类·数据挖掘
2601_9557674220 小时前
观复盾护景贴:东方哲思与双护科技的深度实测
人工智能·科技·ios·iphone·圆偏振光·磁控溅射