Don't ignore the .gitignore


Don't ignore the .gitignore

.gitignore is like the "monitor" of your project. It's the file that tells Git which files and directories it should ignore when you're committing changes.

But the question of what to add to the .gitignore file always makes you scratch your head. Allow me to scratch it for you.

To add*(to the .gitignore)*

  • Build-artifacts: If you're using a build tool like Parcel, you'll probably have a bunch of generated files and directories that you don't need to track in version control. It's usually a good idea to ignore these so you don't clutter up your repository with unnecessary files.

  • Temporary files: If you're working on a project, you might have temporary files lying around that you don't want to commit. For example, you might have a .tmp directory where you store files while you're working on them. It's a good idea to ignore these so you don't accidentally commit them to the repository.

  • Sensitive information: If you have any sensitive information in your project, like passwords or API keys, you'll want to make sure it doesn't get committed to the repository. You can add these files to your .gitignore file to make sure they don't get tracked.

Basically, anything that you can generate on the server must be added to your .gitignore .

To not add*(to the .gitignore)*

  • Source code: If you're working on a project, you'll probably want to track the source code in version control. Make sure you don't add your source code directories to your .gitignore file, or you won't be able to commit your changes!

  • Project configuration files: If you have any configuration files for your project, like a package.json or a .babelrc, you'll want to make sure they're not ignored by Git. These files are important for defining the dependencies and build settings for your project, and you'll want to track them in version control.

  • Documentation: If you're working on a project, you'll probably have some documentation that you want to track in version control.

So basically code that you have written and, is not simply generated by another tech. Along with the configurations and settings for your project.

Never forget to add node_modules to your .gitignore or your repo will become heavier than the moon.