—– weight: 10 title: “Ignoring files” draft: false
Ignoring files #
You can add a file named .gitignore
to the root folder of your repository.
It specifies files that cannot be staged.
This is commonly used to exclude from a repository:
- compiled code (e.g. files with the extension
.class
in Java), - dependencies (e.g. the content of the
/node_modules
folder in a Node.js project), - IDE-generated files (e.g. the
.idea/
folder for IntelliJ), - OS-generated files (e.g.
.DS_Store/
folders for macOS), - etc.
The .gitignore
file uses a dedicated syntax to specify which files should be excluded.
For instance the pattern *.class
excludes all files with the extension .class
.
Here is a quick tutorial about the syntax of .gitignore
files.
This repository also contains a large collection of .gitignore
patterns, for different programming languages, operating systems, programs, etc.
For instance
Java,
Maven,
VSCode,
IntelliJ,
Windows,
macOS,
Linux,
etc.