首页 > 解决方案 > 反应原生 git 忽略

问题描述

这是我的 gitignore 文件

# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate

# Android/IntelliJ
#
build/
.idea
.gradle
*.so
*.dex
*/build/*
local.properties
*.iml

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# BUCK
buck-out/
\.buckd/
*.keystore
!debug.keystore

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

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

# Bundle artifact
*.jsbundle

# CocoaPods
/ios/Pods/

template/plugins/typescript/template/tsconfig.json

我正在创建一个将在 npm 上的模块,问题是我应该如何为 android 设置 gitignore 文件?

它必须放在根文件夹还是 /android 文件夹中?

我尝试添加/build/和 * /dex 但不起作用我想在 react native 中忽略android/app/buildandroid/.gradle文件?

谢谢哈斯

标签: reactjsreact-native

解决方案


您可以使用此代码忽略 git ignore 中的构建文件夹和其他单相文件:

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml

这是有用的链接:recommended .gitignore for react-native


推荐阅读