Page MenuHomec4science

Gitignore
Updated 2,096 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
Last Edited
Jul 2 2018, 16:11

Event Timeline

aubort created this document.Jan 29 2018, 12:58
aubort edited the content of this document. (Show Details)
aubort added a project: c4science.
aubort edited the content of this document. (Show Details)
aubort edited the content of this document. (Show Details)Jul 2 2018, 16:11