Gitignore
Updated 166 Days AgoPublic

To avoid adding and commiting unwanted files to your repository (for example generated machine code, or temporary files) you can use the .gitignore file.

Create this file in any directory of your repository and add the file to the repository.

echo "*.png" >> .gitignore
git add .gitignore
git commit -m "Ignore all PNG files"

In this file you will give a list of files you want Git to ignore. If the files are already part of the Git history, it will ignore new changes to the file and if it's not tracked it will ignore it alltogether (unless you specifically add it with git add myfile).

Each line of the gitignore file can contain either a file name, a full path to a file, a directory or a pattern. Here are some examples:

.gitignore
*.png
image.png
images/image.png
*.swp
*.pdf
*.aux
*.lof
*.log
*.lot
*.fls
*.out

Finally here's a list of .gitignore examples and templates: https://c4science.ch/source/gitignore/

Last Author
aubort
Projects
Subscribers
None