记录一次给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

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

相关推荐
studytosky13 分钟前
Linux 基础开发工具(3):Git 控制与 GDB 调试实用指南
linux·运维·服务器·网络·数据库·git
游戏开发爱好者82 小时前
H5 混合应用加密 Web 资源暴露到 IPA 层防护的完整技术方案
android·前端·ios·小程序·uni-app·iphone·webview
云闲不收2 小时前
AI编程系列——git-worktree并行开发
git·ai编程
秦时明月天明2 小时前
GitLab SSH Key 过期:git pull failed : remote your ssh key has expired
git·ssh·gitlab
2501_915106322 小时前
最新版本iOS系统设备管理功能全面指南
android·macos·ios·小程序·uni-app·cocoa·iphone
游戏开发爱好者82 小时前
HTTPS DDoS 排查 异常流量到抓包分析
网络协议·ios·小程序·https·uni-app·iphone·ddos
桃花岛主703 小时前
命令提交git到github上的步骤
git·github
AI逐月3 小时前
Git 停止追踪已提交文件问题
大数据·git·elasticsearch
是毛毛吧3 小时前
开发环境配置指南:解决 GitHub 连接超时与依赖下载失败的问题
网络·git·网络安全·docker·信息与通信
TouchWorld3 小时前
iOS逆向-哔哩哔哩增加3倍速播放(3)-[横屏视频-全屏播放]场景
ios·swift