【问题标题】:Gitignore multiple projectGitignore 多个项目
【发布时间】:2015-04-21 07:01:54
【问题描述】:

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

  • 1个iOS项目
  • 1 个轨道项目

如何在主目录中只有一个 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

我该怎么办?

【问题讨论】:

标签: ruby-on-rails xcode git gitignore


【解决方案1】:

我还没有尝试过,但 .gitignore 支持 ** 语法从版本 1.8.2.1 开始匹配和忽略子目录。 This answer 在另一个问题中可能有用。

【讨论】:

    【解决方案2】:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-12
      • 2019-06-05
      • 1970-01-01
      • 2022-07-21
      相关资源
      最近更新 更多