.gitignore appears when git status starts

When I run git status, .gitignore is listed in the files without a trace. How can I prevent it from being listed?

The content of .gitignore:

images/builder/
+5
source share
4 answers

You can add .gitignoreto your .gitignorefile, but you probably just want to commit it, since all members of your team (if there are others) will probably have the same files that are listed in .gitignore.

+11
source

To clarify a little what others said, there are clear three categories of things that are excluded, and git uses different exception files for each category:

  • , , , β€” *.o, , , .

    .gitignore ( ). , , , , .gitignore git add .

  • , , , , . , Emacs, , Foo.~1~, git checkouts

    "" , - ~/.gitignore; git, , , :

    git config --global core.excludesfile ~/.gitignore
    

    [ , .]

    , Emacs *~ ~/.gitignore.

  • , "" , , , .

    .git/info/exclude. .git, status ( ).

Git , , .

+5

Just copy the file.
Then it will disappear from the list.
(I first found this confusing.)
You can still edit it to add more items in the future.
And then again commit them to ignore.

+2
source

.gitignoreshould be part of your code. You do not want to exclude, as this is a way to tell your teammates (or yourself on another PC) which files should not be committed

+2
source

All Articles