2,touch .gitignore 创建忽略文件
3,回到工程中shift+command+. 打开隐藏文件,找到.gitignore文件
4,打开.gitignore文件,编辑写入:
*.xcuserstate
project.xcworkspace
xcuserdata
UserInterfaceState.xcuserstate
project.xcworkspace/
xcuserdata/
UserInterface.xcuserstate
5,保存关闭.gitignore文件
6,退出Xcode,在终端输入 git rm --cached YourProjectName.xcworkspace/xcuserdata/YourUsername.xcuserdatad/UserInterfaceState.xcuserstate
7,在终端输入:git commit -m"Removed file that shouldn't be tracked"
8,重新打开Xcode,git commit ,git push
gitignore文件用于忽略无需追踪的文件
gitignore 文件中添加内容
.DS_Store
.svn
profile
*.moved-aside
#CocoaPods
Pods/
!Podfile
!Podfile.lock
## Build generated
build/
DerivedData
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint
*.xcscheme
*.xcworkspace
!default.xcworkspace
DerivedData
.idea
## Obj-C/Swift specific
*.hmap
*.ipa
一、项目还未上传至Git
cd 当前项目文件夹
git init
git remote add origin http://gitlab. xx/xx/xx.git (git目录)
vim .gitignore
(文件中加入上面gitignore 文件内容)
git add .
git commit -m "Initial commit"
git push -u origin master
二、项目已上传至Git 添加gitignore
cd 项目文件名
git pull
vim .gitignore (文件中加入上面gitignore 文件内容)
按esc ->shift+zz 退出
git rm -r --cached .
git add .
git commit -m "add ignore"
git push
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)