I don't understand .gitignore

Question:

I don’t understand why poeple should igonre files with .gitignore. What’s the point of ignoring files and what does it do?

@SnakeyKing heres a website that explains what Gitignore does » Git - gitignore Documentation.

3 Likes

The .gitignore file is a text file used by the version control system Git to specify intentionally untracked files and directories that should be ignored. Some files are sometimes ignored!

3 Likes

For example, if you didn’t want to track changes in the .pythonlibs/node_modules folder, you would put that in .gitignore.

1 Like

Using .gitignore means that when you commit something, it doesn’t commit anything ignored by .gitignore. Say you installed a lot of node_modules, and they don’t need to be committed, you can type ./node_modules into .gitignore.

However I would like to say that in order for a gitignore file to be effective, it needs to have been created and populated before the initialization of the git repo.