git untracked files - how to ignore

JDesigns picture JDesigns · Jun 9, 2011 · Viewed 43.6k times · Source

When I run git status, I see the "Untracked files" section has many files (some with a "." extension.)

I don't think I have to do anything, but it doesnt look good to see these files whenever I run git status. Is there any way to not to see these files?

Answer

wilhelmtell picture wilhelmtell · Jun 9, 2011

Files that are "yours", files that no one else sees, write in .git/info/exclude.

For files that everyone else sees, write them down in .gitignore at the project top directory and then add and commit the .gitignore file.

For example, your .gitignore might look like so:

*.o
.*.sw[op]
*~