问题描述
root /
.git
deploy /
Site /
blah /
more_blah /
something.local
else.development
耙文件
.gitattributes
$ hr
编辑:为了进一步阐明上述情况,目录有一个尾随的/
并且子目录在目录下缩进,所以blah
和more_blah
是目录,但是Rakefile
和.gitattributes
是文件,但全部四个都是Site
$ hr
我正在运行
git-archive
从Site
目录,如下所示:git archive --format = tar --prefix = git-v0.0.1 / v0.0.1 | gzip> ../deploy/git-v0.0.1.tar.zip
但是无论我输入什么模式。 gitattributes,结果归档文件总是包含
Rakefile
。我试过:
$ b $ ul
他们没有一个像我期望的那样工作。有人愿意指出我明显但不明显的解决方案吗?任何帮助非常感谢。
我对不清楚的道歉表示歉意。
- 我说我使用的模式似乎不起作用,但我使用export-忽略。
-
Rakefile
不是目录,只是一个文件 - 由于重命名了某些文件,但未将重命名归档似乎得到了一些好的结果。我的错! :S
这是我的 .gitattributes
(坐在<$
$ p $ Rakefile export-ignore
* .local export-忽略
* .development export-ignore
* .staging export-ignore
我相信@Jefromi提供了我需要的信息来解决这个问题,但他的评论太谦虚了,我想保持我的接受率为100%(正确),所以我会在这里给出答案:
好的,需要两件事。 - worktree-attributes
本身不起作用,但当我将 .gitattributes
文件移动到根目录时从网站目录,然后它的工作。再次,(通常是您的项目的根目录),所以我觉得这些文档有点让人失望(一次) 。我也认为,当.gitignore正常工作时,IMO并不是你想要的行为。
I've a directory structure like this:
root/
.git
deploy/
Site/
blah/
more_blah/
something.local
else.development
Rakefile
.gitattributes
Edit: to further clarify the above, directories have a trailing /
and children are indented beneath a directory, so blah
and more_blah
are directories but Rakefile
and .gitattributes
are files, but all four are children of Site
.
I'm running git-archive
from the Site
directory like so:
git archive --format=tar --prefix=git-v0.0.1/ v0.0.1 | gzip > ../deploy/git-v0.0.1.tar.zip
but whatever pattern I put in .gitattributes, the resulting archive always contains Rakefile
. I've tried:
- Rakefile
- Site/Rakefile
- */Rakefile
- ./Rakefile
- Rakefile*
- *
None of them work as I'd expect. Is anyone willing to point out the obvious yet non-obvious to me solution? Any help is much appreciated.
My apologies for not being clear.
- I said the pattern I was using didn't seem to work, but I am using "export-ignore" after the pattern.
Rakefile
is not a directory, just a file- This is not true, due to having renamed certain files but not archiving the commit with the rename I was appearing to get some good results. My bad! :S
This is my .gitattributes
(sitting in the directory Site
)
Rakefile export-ignore
*.local export-ignore
*.development export-ignore
*.staging export-ignore
I believe @Jefromi gave the information needed for me to resolve this with his comments, but is too humble to take the credit, and I'd like to keep my acceptance rating at 100% (quite rightly) so I'll give the answer here:
Ok, two things were needed. --worktree-attributes
on its own did not work, but when I moved the .gitattributes
file into the root dir from the Site dir, then it worked. Again, the Git book implies that the file doesn't need to be in the root for it to work "... (normally the root of your project)", so I feel a bit let down by those docs (for once). I also think it's not-what-you'd-think behaviour to have to opt in the file when .gitignore just works, IMO.
这篇关于git忽略.gitattributes模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!