git配置忽略文件

作者: 娜娜的世界123 | 来源:发表于2018-08-31 14:32 被阅读0次

一、步骤
1. cd 到项目根目录
2. touch .gitignore
3. 把内容粘贴进去
4. 提交上传忽略文件
二、 iOS忽略文件内容

# 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/

*/.DS_Store
.DS_Store

## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#

 Pods/
 Pods

#
# Add this line if you want to avoid checking in source code from the Xcode workspace
 *.xcworkspace
 *.xcworkspace/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

其他 :设置Git全局忽略文件

配置全局忽略文件,我们就不必给每一个项目添加单独的忽略文件
1.进入用户目录下,将第一步中配置好的.gitignore文件拷贝到用户目录下,将这个文件改个名字,名字随意,自己好认就行

  1. 执行命令git config --global core.excludesfile ~/.gitignore_global
    效果如下图.gitignore_global就是我自己起的名字:
    图片.png

至此之后check out 下来的项目都会自动应用这个.gitignore_global文件中所忽略的文件。

相关文章

网友评论

    本文标题:git配置忽略文件

    本文链接:https://www.haomeiwen.com/subject/oamswftx.html