This file defines what Git should ignore

Weindependently evaluateall of our recommendations.

If you select links we provide, we may receive compensation.

What Is a GITIGNORE File?

Screenshot of several GITIGNORE files in Windows 10 that open with Notepad

A file with the GITIGNOREfile extensionis a Git Ignore file used with the version/source control system calledGit.

This file specifies which files and folders should be ignored in a given source code.

If you’re on Windows, you’re able to use the built-in Notepad program, orNotepad++.

To open one on macOS, use Gedit.

Linux users (as well as Windows and macOS) might findAtomuseful for opening and editing GITIGNORE files.

Put a different one in each working directory, and the ignore rules will work for each folder individually.

GITIGNORE files are useful for sharing the ignore rules with anyone else who might clone your repository.

This is why,according to GitHub, it’s important to commit it into your repository.

you could use a site likegitignore.ioto create GITIGNORE files for your project.

How to Convert To/From a GITIGNORE File

Seethis Stack Overflow threadfor information on converting CVSIGNORE to GITIGNORE.

SeeConvert SVN Repositories to Git Repositoriesfor help doing that.

Also, seethis Bash scriptthat might be able to achieve the same thing.

To store your GITIGNORE file to a text file format, use one of the text editors mentioned above.

Most of them can convert to TXT, HTML, and similar plain text formats.

If your file isn’t working as described above, check that you’re reading the file extension correctly.

FAQ

you’ve got the option to initiate the file with yourchosen text editor.

you might open and change both files in Visual Studio fromRepository controls>Ignore & Attributes Files.

If you want to ignore the contents of a particular directory, open your GITIGNORE file and typefolder_name/.