DEV Community

Bodhisha Thomas
Bodhisha Thomas

Posted on

When to use .gitignore and .git/info/exclude

Both .gitignore and .git/info/exclude are used to ignore files from staging in git.

.gitignore

  • If a file should be ignored in all clones of the repository, you would use .gitignore
  • This file needs to be committed and the files mentioned would be ignored in all the clones.

.git/info/exclude

  • If for some reason you need to locally ignore certain files in a single clone, you would use .git/info/exclude
  • This file acts as a .gitignore for your own local git folder and is not committed or shared with anyone else.

References

Top comments (0)