为什么 git add -A 没有添加我所有的 png 文件?
Why git add -A doesn't add all my png files?
我有一个包含一堆 .png
文件的存储库。这些被组织成两个子目录
icon/
screen/
您可能会注意到,它们是 iOS 应用程序的图标和屏幕(我不知道它是否有用)。
我执行了一个 git init
和一个 git add -A
。
screen/
中的 PNG 文件被跟踪。
icon/
中的 PNG 文件仍未被跟踪。
这是我的全局.gitignore
*.retry
# Dropbox settings and caches
.dropbox
.dropbox.attr
.dropbox.cache
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# Ignore redis binary dump (dump.rdb) files
*.rdb
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# workspace files are user-specific
*.sublime-workspace
# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project
# sftp configuration file
sftp-config.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
.vagrant/
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
这是我的本地.gitignore
build/
.retry
我也尝试 运行 git check-ignore -v *
查找哪个 .gitignore
规则阻止图标 png 文件被跟踪,但没有规则:
.gitignore:1:build/ build
/Users/me/.gitignore_global:1:*.retry copy_resources.retry
我也尝试使用 ls -al@
检查扩展属性,但我无法发现任何差异。
能否解释一下原因并提供解决方案?
使用你的设置在本地进行了一些测试,在你的 gitignore 的第 133 行你有行
Icon
这导致目录被忽略。
决定你是否需要这个规则,如果你不删除那一行 re-run
git add -A
另一种方法是重命名您的目录
编辑:为了阐明我是如何识别这个的,我使用了
git check-ignore -v icon/test1.png
返回
.gitignore:133:Icon icon/test1.png
我有一个包含一堆 .png
文件的存储库。这些被组织成两个子目录
icon/
screen/
您可能会注意到,它们是 iOS 应用程序的图标和屏幕(我不知道它是否有用)。
我执行了一个 git init
和一个 git add -A
。
screen/
中的 PNG 文件被跟踪。
icon/
中的 PNG 文件仍未被跟踪。
这是我的全局.gitignore
*.retry
# Dropbox settings and caches
.dropbox
.dropbox.attr
.dropbox.cache
# Logs
logs
*.log
npm-debug.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules
jspm_packages
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# Ignore redis binary dump (dump.rdb) files
*.rdb
# cache files for sublime text
*.tmlanguage.cache
*.tmPreferences.cache
*.stTheme.cache
# workspace files are user-specific
*.sublime-workspace
# project files should be checked into the repository, unless a significant
# proportion of contributors will probably not be using SublimeText
# *.sublime-project
# sftp configuration file
sftp-config.json
# Package control specific files
Package Control.last-run
Package Control.ca-list
Package Control.ca-bundle
Package Control.system-ca-bundle
Package Control.cache/
Package Control.ca-certs/
bh_unicode_properties.cache
# Sublime-github package stores a github token in this file
# https://packagecontrol.io/packages/sublime-github
GitHub.sublime-settings
.vagrant/
# Virtualenv
# http://iamzed.com/2009/05/07/a-primer-on-virtualenv/
.Python
[Bb]in
[Ii]nclude
[Ll]ib
[Ll]ib64
[Ll]ocal
[Ss]cripts
pyvenv.cfg
.venv
pip-selfcheck.json
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint
*.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
这是我的本地.gitignore
build/
.retry
我也尝试 运行 git check-ignore -v *
查找哪个 .gitignore
规则阻止图标 png 文件被跟踪,但没有规则:
.gitignore:1:build/ build
/Users/me/.gitignore_global:1:*.retry copy_resources.retry
我也尝试使用 ls -al@
检查扩展属性,但我无法发现任何差异。
能否解释一下原因并提供解决方案?
使用你的设置在本地进行了一些测试,在你的 gitignore 的第 133 行你有行
Icon
这导致目录被忽略。
决定你是否需要这个规则,如果你不删除那一行 re-run
git add -A
另一种方法是重命名您的目录
编辑:为了阐明我是如何识别这个的,我使用了
git check-ignore -v icon/test1.png
返回
.gitignore:133:Icon icon/test1.png