2017-02-17 144 views
4

我有一个包含一堆.png文件的回购。那些被组织成两个子目录为什么git add -A不会添加我所有的png文件?

  • icon/
  • screen/

enter image description here

enter image description here

正如你可能会注意到,他们的图标和屏幕的iOS应用(我不不知道它是否是一个有用的信息)。我执行git initgit 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 [email protected]检查扩展属性,但我无法发现任何差异。

您能解释一下为什么并提供解决方案吗?

+0

从哪个位置开始'git add -A'?另外,作为一个附注,在Git中避免版本化二进制文件通常是一个好主意,尽管版本化一些小图标并不是什么坏事。 –

+0

我从项目根目录下'git add -A'。 –

+1

也许检查你的'.gitignore'只是一个完整的检查。 –

回答

3

做了一些测试本地您的设置,您gitignore的133行,你有

Icon 

这是造成目录被忽略的行。

确定是否需要这条规则,如果不删除该行并重新运行

git add -A 

另一种方法是重命名目录

编辑:为了澄清我如何确定这个我用

git check-ignore -v icon/test1.png 

其返回

.gitignore:133:Icon icon/test1.png 
+0

谢谢,彼得。有用!这很奇怪,我无法使用'git check-ignore -v *'来发现它,这也很奇怪,git不区分大小写。据我所知,git默认是区分大小写 –

+0

不用担心阿德里亚诺,祝你有美好的一天! –

+2

@AdrianoDiGiovanni:Git尝试(并非总是非常成功)来了解主机系统是否进行大小写折叠。 MacOS HFS +默认情况下可以折叠,因此Git会将'core.ignoreCase'设置为'true',然后知道'icon'匹配'Icon'。 – torek

相关问题