.gitignore file is used in a git repository to ignore the files and directories which are unnecessary to project this will be ignored by the git once the changes as been committed to the remote repository. The type of files which will gets ignored are the mainly temporary files and the files which should not be versioned.