Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React native - which files to add to GIT?

I am starting off on a React Native project on multiple computers. I'm fairly new to React Native, hence probably this newb question :

What is the minimum of files I need to track with Git in order to be able to sync and work on multiple computers? The whole folder? Can I leave out the platform specific build dirs (ios, android) and have a script recreate those after a git pull origin?

like image 705
El Dude Avatar asked Jun 24 '18 05:06

El Dude


1 Answers

You can look at this from a different perspective:

gitignore.io/api/reactnative lists the files/folders you need to not track (ignore)

So simply add the rest (after creating a .gitignore for your react application).

As the OP El Dude mentions in the comments, the react-native eject command can come in handy.
As described in this gist:

If your project has any issues with the native folders, you can rebuild them by deleting both the ios and android directories at the root level of your project and running this command:

$ react-native eject

Running this command will check if the ios and android directories exist and then rebuild whichever one is missing.

More generally, any folder that you can generate does not have to be part of your Git repository.

like image 114
VonC Avatar answered Oct 04 '22 04:10

VonC