Skip to content

Instantly share code, notes, and snippets.

@HawkingOuYang
Last active September 6, 2021 06:17
Show Gist options
  • Save HawkingOuYang/5820ce5538956911bea4 to your computer and use it in GitHub Desktop.
Save HawkingOuYang/5820ce5538956911bea4 to your computer and use it in GitHub Desktop.
.gitignore 语法 与 Xcode
################################################
# Added by OYXJ on 2016-01-01
#
# Configure git to track only one file extension
# http://stackoverflow.com/questions/12799855/configure-git-to-track-only-one-file-extension
#
# Using .gitignore to ignore everything but specific directories
# http://stackoverflow.com/questions/5241644/using-gitignore-to-ignore-everything-but-specific-directories
#
# Git ignore file for Xcode projects (重要)
# http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#
# Xcode 7: ignore .xcscmblueprint in repository?
# http://stackoverflow.com/questions/31584297/xcode-7-ignore-xcscmblueprint-in-repository
# https://github.com/github/gitignore/blob/master/Objective-C.gitignore (对,这个)
########################
# Blacklist everything (黑名单:所有文件 和 所有路径)
*
# Whitelist .gitignore (白名单:.gitignore 这类文件)
!.gitignore
!.gitattributes
!.gitkeep
# Whitelist all directories (白名单:root路径 和 子路径)
#!*/
############
# Whitelist certain directories (白名单:子路径)
# 方式一:
#文稿这个目录
!Documents
!Documents/
#文稿这个目录的所有子目录
!Documents/**/
# 方式二:
# Here's how I did it - you essentially have to walk up the paths,
# you can't wildcard more than one level in any direction:
# 写完整一级又一级的目录,中间不可缺级,不可越级。
#!A/ #一级目录
#!A/B/ #二级目录
#!A/B/C/ #三级目录
#!A/B/C/D/ #四级目录
#!A/*/*/*/*/ #五级目录
#!A/*/*/*/*/*/ #六级目录
#!A/*/*/*/*/*/*/ #七级目录
######
# Whitelist the file you're interested in. (白名单:文件 或者 文件后缀)
!*.png #文件后缀
#!abc.txt #特定文件
###
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment