在React Native项目中应忽略哪些文件夹git?

Yua*_* He 46 reactjs react-native

我正在玩Facebook/React Native,当我跑步时git init,我不知道应该忽略什么node_modules文件夹,

我应该提交所有iOS文件夹吗?

谢谢

des*_*ant 27

React Native CLI .gitignore在您启动新项目时创建一个文件:

react-native init <ProjectName>
Run Code Online (Sandbox Code Playgroud)

它涵盖了应该/可以忽略的所有基础知识.

资料来源:https://github.com/facebook/react-native/blob/master/local-cli/templates/HelloWorld/_gitignore

  • 很奇怪,它从来没有为我创建该文件. (6认同)
  • 请注意,某些文本编辑器隐藏以`.`开头的文件。 (2认同)

Sop*_*ert 9

我们建议这个.gitignore:

https://github.com/facebook/react-native/blob/v0.2.1/Examples/SampleApp/.gitignore

它忽略了用户特定的Xcode文件和node_modules目录.

  • 链接已死(这是我们不喜欢仅链接答案的原因之一:) (2认同)

Dhe*_*.S. 9

gitignore.io为react-native建议以下.gitignore文件:

https://www.gitignore.io/api/reactnative创建

### ReactNative ###
# React Native Stack Base
### ReactNative.Xcode Stack ###
# 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/

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

### ReactNative.Node Stack ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Typescript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env


### ReactNative.Buck Stack ###
buck-out/
.buckconfig.local
.buckd/
.buckversion
.fakebuckversion

### ReactNative.macOS Stack ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### ReactNative.Gradle Stack ###
.gradle
**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

### ReactNative.Android Stack ###
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/dictionaries
.idea/libraries

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild

# Freeline
freeline.py
freeline/
freeline_project_description.json

### ReactNative.Linux Stack ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# End of https://www.gitignore.io/api/reactnative
Run Code Online (Sandbox Code Playgroud)


Col*_*say -2

如果你看一下 React Native 的例子:

https://github.com/facebook/react-native/tree/master/Examples

每个都有一个目录,其内容类似于react-native-cli生成的iOS目录。进一步查看 Xcode 项目文件,它也在其中被引用,并查看内容 - 有诸如启动屏幕之类的东西。

所以是的,iOS 目录是需要的。

关于node_modules,我建议您查看这个答案,它提供了更多信息:

/sf/answers/1359148241/