Git ignore is a special file in git version control, its specified by the file .gitignore .

As the name indicates, it’s used to make that git not track specific files. For example when you have application logs, configuration files or compiled files.

Examples

If you want to ignore a, specific directory , let’s call it config:

config/*

To ignore all files with the .log extension

*.log

You also can ignore a, specific file, like passwords.pass

passwords.pass

Another less known option is the exceptions, you can use ! to indicate that you want to track an ignored part of a path. In this example you will ignore all except /foo/bar

/*
!/foo
/foo/*
!/foo/bar

Tools

Usually when you make a project you use a template depending on the language that you are using.

You can use this tool to generate a language specific gitignore:

https://www.toptal.com/developers/gitignore

Github also haves a repository with gitignore templates for different languages

https://github.com/github/gitignore