Should I exclude `ios`?

After running expo run:ios I have a new ios directory in my project. Should this be ignored or excluded by Git?

Hey @orome, this is expected. As well, your gitignore should already be properly configured to handle what should be ignored within the ios native dir.

@adamjnav So I can just rely on the settings that were added automatically to gitignore and the rest of what’s in ios should be added and committed, correct?

Hi @orome

expo run:* has the unfortunate (in my opinion) side effect of basically turning your app into a bare workflow app.

Because the Expo Team has done an amazing job of supporting normal React Native apps this is not a huge problem, but it means you have a few options for what you can/should do:

  • You could switch back to the managed workflow by reverting the changes made by expo run, including removing the android and ios directories entirely and optionally reverting changes to .gitignore, package.json, package-lock.json/yarn.lock and removing index.js and metro.config.js (unless you created them yourself). This is what I do. See also expo.fyi/prebuild-cleanup
  • You could stay with the bare workflow and refresh the native code with expo prebuild --clean as needed (e.g. after making changes to app.json). With this option you would add android and ios to .gitignore
  • You could just stick to the bare workflow like a normal React Native app and manually make changes to the android/ios directories as needed. With this option you would commit android and ios

EDIT: I generally avoid expo run. If I want to build locally I do it with eas build --local, which does not make changes to your app. I do sometimes run expo prebuild to test a config plugin, but I then revert all of the changes and make sure not to commit them.

3 Likes

This was very helpful and totally changed the experience of using Expo/EAS for me! (It was having done expo run:ios that messed me up. I’m never doing that again!)

1 Like

To be clear, expo run has its uses. See the Use Cases section here:

1 Like

Yeah saw that. On my list of things to read. For now though I’m playing it safe.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.