Default .gitignore generated by react-native init has overly aggressive excludes for Android/IntelliJ project files
See original GitHub issueDescription
Generating a new project with the npx react-native init
command creates a .gitignore
file which excludes the following file types under the Android/IntelliJ heading
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
Excluding the entire .idea
directory is incorrect. In some cases, excluding all .iml
files is incorrect. See https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems
React Native version:
$ npx react-native info
info Fetching system and libraries information...
System:
OS: macOS 11.1
CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
Memory: 113.26 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 14.15.3 - ~/n/bin/node
Yarn: Not Found
npm: 6.14.11 - ~/n/bin/npm
Watchman: Not Found
Managers:
CocoaPods: 1.9.1 - /Users/chris/.rvm/rubies/ruby-2.7.0/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.3, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 28, 29, 30
Build Tools: 28.0.3, 29.0.3, 30.0.3
System Images: android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.3/12C33 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_275 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.4 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
Provide a detailed list of steps that reproduce the issue.
- Generate a new project with
npx react-native init
, for examplenpx react-native init ReactNativeHello
- Look at the generated
.gitnore
file
Expected Results
Should only exclude files as recommended by JetBrains at: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839-How-to-manage-projects-under-Version-Control-Systems
For example, JetBrains says:
Here is what you need to share:
- All the files under the
.idea
directory in the project root except theworkspace.xml
,usage.statistics.xml
, andtasks.xml
files and the shelf directory which store user-specific settings- All the .iml module files that can be located in different module directories (applies to IntelliJ IDEA)
The current generated .gitnore
excludes the entire .idea
directory and .iml
files, both of which are incorrect according to the above.
Also, for anyone choosing the legacy IntelliJ project format (.ipr/.iml/.iws files), then excluding .iml
is incorrect:
Share the project
.ipr
file and all the.iml
module files, don’t share the.iws
file as it stores user specific settings
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
@chrisbartley This is a very opinionated issue, it depends on the community to decided the best route. I would propose to start a thread in discussions & proposals https://github.com/react-native-community/discussions-and-proposals
Closing for now until a decision is made in the proposals.
Don’t you mind sending a PR to update it?