当Git与Xcode一起使用时,我应该在.gitignore中包含哪些文件?
当前回答
gitignore。io:为你的项目创建有用的gitignore文件
Example: Preview | Edit Programming Languages: Objective-C Swift Build Automation Tool: SwiftPackageManager Carthage IDEs: Xcode Operating Systems: macOS Steps to use in Terminal (Refer to the YouTube Video) Create Git global config alias (One time only) git config --global alias.ignore '!gi() { curl -L -s https://www.gitignore.io/api/$@ ;}; gi' Enter the project directory cd <the project directory> Generate .gitignore file git ignore Objective-C,Swift,SwiftPackageManager,Carthage,Xcode,macOS >.gitignore Add and commit .gitignore file git add .gitignore git commit -m "Add .gitignore file"
其他回答
以下是GitHub默认用于新Xcode存储库的.gitignore:
https://github.com/github/gitignore/blob/master/Objective-C.gitignore
它可能在任何给定的时间都是合理正确的。
关于“build”目录排除-
如果您将构建文件放在与源文件不同的目录中,就像我所做的那样,您不必担心树中的文件夹。
这也使得共享代码变得更加简单,防止臃肿的备份,甚至当你依赖于其他Xcode项目时(同时要求构建彼此位于相同的目录中)。
你可以从Github gist https://gist.github.com/708713获取最新的拷贝
我当前的。gitignore文件是
# Mac OS X
*.DS_Store
# Xcode
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
*.xcuserstate
project.xcworkspace/
xcuserdata/
# Generated files
*.o
*.pyc
#Python modules
MANIFEST
dist/
build/
# Backup files
*~.nib
GitHub的人们为Xcode项目提供了详尽的。gitignore文件:
斯威夫特:https://github.com/github/gitignore/blob/master/Swift.gitignore
objective - c: https://github.com/github/gitignore/blob/master/Objective-C.gitignore
对于Xcode 5,我添加:
####
# Xcode 5 - VCS metadata
#
*.xccheckout
选自Berik的答案
我建议使用joe生成一个.gitignore文件。
对于iOS项目,执行如下命令:
$ Joe g osx,xcode > .gitignore
它会生成。gitignore:
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
build/
DerivedData
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
*.xcuserstate
推荐文章
- 在成功提交我的应用程序后,“太多符号文件”
- 复制并重命名Xcode项目和相关文件夹
- 在Bash命令提示符上添加git分支
- 如何更改Git日志日期格式
- 如何从macOS完全卸载蟒蛇
- git pull -rebase和git pull -ff-only之间的区别
- GitHub -致命:无法读取用户名https://github.com':没有这样的文件或目录
- 撤消git平分错误
- 使用.gitconfig配置diff工具
- Xcode 4挂在“附加到(应用程序名称)”
- 为什么单元测试中的代码不能找到包资源?
- 如何配置Mac OS X术语,使git有颜色?
- Visual Studio Code: .git文件夹/文件隐藏
- “node_modules”文件夹应该包含在git存储库中吗
- 为什么git-rebase给了我合并冲突,而我所做的只是压缩提交?