Gitignore多个项目

时间:2015-02-19 19:03:58

标签: ruby-on-rails xcode git gitignore

我有一个包含2个子目录的主目录:

  • 1个iOS项目
  • 1 rails project

如果主目录中只有一个gitignore,我怎么能忽略这两个gitignore:

*.rbc
capybara-*.html
.rspec
/log
/tmp
/db/*.sqlite3
/db/*.sqlite3-journal
/public/system
/coverage/
/spec/tmp
**.orig
rerun.txt
pickle-email-*.html

## Environment normalisation:
/.bundle
/vendor/bundle

# these should all be checked in to normalise the environment:
# Gemfile.lock, .ruby-version, .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc

# if using bower-rails ignore default bower_components path bower.json files
/vendor/assets/bower_components
*.bowerrc
bower.json

# Ignore pow environment settings
.powenv

# sublime text
*.sublime-*


# Xcode

.DS_Store
*/build/*
*.pbxuser
!default.pbxuser
*.mode*
!default.mode*
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
.idea/
*.hmap
*.xcworkspace
*.xcuserdata

#CocoaPods

Pods/
Podfile.lock

但它似乎不能忽略我的配置,我想避免这个:

# Xcode

mystore-ios/.DS_Store
mystore-ios/*/build/*
mystore-ios/*.pbxuser
mystore-ios/!default.pbxuser
mystore-ios/*.mode*
mystore-ios/!default.mode*
mystore-ios/*.perspectivev3
mystore-ios/!default.perspectivev3
mystore-ios/xcuserdata
mystore-ios/profile

我该怎么办?

2 个答案:

答案 0 :(得分:1)

.gitignore在子目录中工作,所以你可以这样做:

master_directory/ios_project/.gitignore
master_directory/rails_project/.gitignore

这些.gitignore文件将覆盖父目录中的任何.gitignore文件。

答案 1 :(得分:0)

我没有尝试过,但.gitignore支持版本**的{​​{1}}语法,以便通过子目录进行匹配和忽略。另一个问题This answer可能有用。