0 votes
1 view
in DevOps and Agile by (20k points)

Does the .gitignore file belong in the .git folder structure somewhere or in the main source files?

1 Answer

+1 vote
by (28.4k points)

You need to put .gitignore in the working directory. It won't work if you put it in the .git (repository) directory. In other words, you can place the .gitignore file anywhere in the working directory, i.e in any folder where your code prevails. But the best practice would be to place the .gitignore file in the root directory. This means that one .gitignore file for one entire repo. This makes managing the ignored files more effectively. 

$ ls -1d .git*

$ .git

$ .gitignore

Welcome to Intellipaat Community. Get your technical queries answered by top developers !

Categories

...