What do I put in the gitignore?

Asked

Viewed 1,138 times

0

I’m learning to play git and GitHub these weeks. I came across a certain doubt:

I figured we could put a file .gitignore in our project for it to "ignore" certain files, so it is really necessary to use it? What kind of files I put in it?

I’m also creating an typescript:

inserir a descrição da imagem aqui

Seeing these files, there are some I can ignore before going up on github?

  • No need to use. See this. For Nodejs it is convenient to ignore the folder node_modules because anyone who has the code can do npm install to install the dependencies.

  • gitignore is used to prevent you from deleting unnecessary project files. Every programming language has some files that are generated when you compile the project but these files are not useful for those who download and run the project and in these cases are defined files or folders that should be disregarded when you are Versionar something.

  • puts in it what ignore, depends on the project, jar files, exe, dll, etc

3 answers

1

The hidden file .gitignore will allow you to decide which files are in your local repository that you do not want to go up to the remote repository, as the name says they will be ignored even if you make any changes to them.

For example, certain files that are automatically generated by a particular programming language or even files with credentials as an example, this depends on each case of course.

Something interesting with the documents .gitignore is that allows you to use certain tricks. For example, ignoring all files with a certain extension can be done as follows:

*.pdf

You can access this github repository:

https://github.com/github/gitignore

In it are several files . gitignore for various programming languages such as java, javascript, python and others that I believe will help you and personally use and I end up adding other things. I hope I helped you

0

Good night Kaiky Santos,

The file. gitignore is not required for your application, however it is of great help when you do not intend not to upload a specific file or folder.

Below are some useful links about gitignore and some examples of gitignore for nodejs and typescript.

Link about gitignore: https://git-scm.com/docs/gitignore

Link containing simple example of gitignore nodejs: https://gist.github.com/ericelliott/a9c8e7810d94fdd90993e30552674244

Link to debating gitignore typescript: https://stackoverflow.com/questions/39679722/gitignore-js-files-made-from-typescript

0

Well, in gitignore you can add files that won’t be needed in the repository, such as module folder, test files etc. This file basically serves to make your day easier, Voce doesn’t need to send unnecessary files to your repository!

So long, and have a great day!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.