简体   繁体   中英

git ignore some files but its not in .gitignore

I have local git repository and there are a.gitignore and.gitattributes files in the directory. my.svg files are being ignored by git but its not in the.gitignore file

this is my.gitignore file

# CakePHP specific files #
##########################
/config/app.php
/config/.env
/logs/*
/tmp/*
/vendor/*

# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

# Tool specific files #
#######################
# vim
*~
*.swp
*.swo
# sublime text & textmate
*.sublime-*
*.stTheme.cache
*.tmlanguage.cache
*.tmPreferences.cache
# Eclipse
.settings/*
# JetBrains, aka PHPStorm, IntelliJ IDEA
.idea/*
# NetBeans
nbproject/*
# Visual Studio Code
.vscode
# Sass preprocessor
.sass-cache/
.phpstorm.meta.php/*
.github

i used this command to show me the ignoed files git status --ignored and this is the result:

.github/
.idea/
.phpstorm.meta.php/
codealike.json
config/app.php
logs/
plugins/AdminView/
plugins/MetronicAdminView/
plugins/SiteView/webroot.zip
tmp/
vendor/

the folder plugins is where the.svg files are

but when I used git check-ignore **/ -v to see where I ignored this the folder plugin doesn't show at all

.gitignore:5:/logs/*    logs/
.gitignore:6:/tmp/*     tmp/
.gitignore:7:/vendor/*  vendor/

how can I find where the problem is?

I found the answer. it's because of the

Icon?

in the CakePHP .gitigore that ignored the .svg files

and something that I found was that you should write the exact path for git check-ignore -v to work properly

so when I run git check-ignore -v plugins i receive nothing

but when run

git check-ignore -v plugins/AdminView/webroot/img/icons/logout.svg

I received this response

.gitignore:16:Icon?     plugins/AdminView/webroot/img/icons/logout.svg

hope this helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM