Which files for a git repository?

Hi,

which files should i use for a git repository and which i should add to the .gitignore?

  1. I dont use reportWebVitals.js, but perhaps later. So i keep this file, but is it usefull for the repository now?
  2. App.test.js and setupTest.js are unnecessary or?
  3. package…json files are necessary for a repository?

2022-02-15_13h52_54

I use the course “Mastering React”. Is there a video which answers this, you can refer to it.
I know “Adding code to a git repository” but it doesn’t answer this questions.

Best regards
René

This seems to be a comprehensive post on what you should have in your .gitignore.

package.json and package-lock.json are necessary because they describe your project and your project’s dependencies.

If you plan to keep the reportWebVitals.js file, I think you should commit it to your repo. Chances are your project is referring to it in your index.js anyway.

For App.test.js and setupTest.js, why not make use of these and write a unit test?

Long story short, I’d commit all of these files to the repo.

1 Like