Search code examples
gitgitignore

.gitignore does not ignore files with certain extensions


I added this to my .gitignore file:

# JPEG
*.jpg
*.jpeg
*.jpe
*.jif
*.jfif
*.jfi

# JPEG 2000
*.jp2
*.j2k
*.jpf
*.jpx
*.jpm
*.mj2

# JPEG XR
*.jxr
*.hdp
*.wdp

# Graphics Interchange Format
*.gif

# RAW
*.raw

# Web P
*.webp

# Portable Network Graphics
*.png

# Animated Portable Network Graphics
*.apng

# Multiple-image Network Graphics
*.mng

# Tagged Image File Format
*.tiff
*.tif

# Scalable Vector Graphics
*.svg
*.svgz

# Portable Document Format
*.pdf

# X BitMap
*.xbm

# BMP
*.bmp
*.dib

# ICO
*.ico

# 3D Images
*.3dm
*.max

Found here.

Then I added some .png files and commited this change and pushed it, but the files are showing up if I execute git status.

    geändert:       skin/frontend/venedor/custom/images/kreis_rot_weiss.png
    geändert:       skin/frontend/venedor/custom/images/kreis_weiss.png

What am I doing wrong?


Solution

  • I think these files were in the staging area before I made my changes to the gitignore file. I executed git reset --hard HEAD and added my png files again and now they don't appear if I call git status

    So .gitignore will only apply to new files and not to files already in the staging area.