Purpose of the .gitignore file

Hey there,

I’m familiar with Git and how to use a .gitignore file, but I’m curious: why is there a .gitignore file in the glitch-hello-* projects?

I was cleaning out my project and saw the file; I have no use for it, since I’m not using source control. I was going to just delete the file, but wanted to check in here first, in case there’s some specific requirement for having it present in the project.

1 Like

welcome, @nickfourtimes - and great question! tl;dr they are files for listing what git and Glitch remixes should ignore (as every Glitch project is a git repo right out of the box and our Rewind feature depends on the Git history). If you delete it your app won’t break but it will make your file tree and exports potentially very messy.

.gitignore files are a place for you to list files in your project that you do not want to have saved in your git history - so it’s a git thing, not specifically Glitch, but the Glitch editor does hide gitignore’d files and folders from the sidebar and exclude them from remixes or exports to Github.

As for their usefulness in your case, it depends on what starter you’re working from, the gitignore file may be very useful. For example, the generated static sites like the React starter and Eleventy starter have /build folders that the app throws the built static files in, and you’d want to gitignore those because those aren’t source files meant to be edited. Or you want to ignore the npm_modules folder because you don’t want to export all that stuff that will end up being reinstalled anyway if you export to Github.

1 Like