Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git untracked files - how to ignore

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?

like image 456
JDesigns Avatar asked Jun 09 '11 15:06

JDesigns


People also ask

Does git add ignore untracked files?

The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area.

How do I ignore a file in git?

Use your favorite text editor to open the file called . git/info/exclude within the root of your Git repository. Any rule you add here will not be checked in, and will only ignore files for your local repository.

Why is Gitignore showing up in untracked files?

gitignore file is showing up on the status, because it's untracked, and git sees it as a tasty new file to eat! Since . gitignore is an untracked file however, it is a candidate to be ignored by git when you put it in . gitignore!


Video Answer


1 Answers

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]
*~
like image 130
wilhelmtell Avatar answered Oct 05 '22 18:10

wilhelmtell