Skip to content
Advertisement

Should .gitignore also be added and commited to git?

.gitignore is used for ignoring the files which are not expected to be commited to git. It locates in the root directory of the project. So this file should also be added and commited as other files or?

Advertisement

Answer

Yes, it’s a good practice to commit it, to avoid people in your team to commits temporary files, builds, and other stuffs that aren’t project specific.

But if you want to have a modified one locally with a private or testing configuration, you can but if you want to apply changes you have to add it with git add .gitignore.

Documentation: https://git-scm.com/docs/gitignore

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement