.hgignore 目录“_notes”整个存储库树?
我想忽略整个存储库中的所有目录“_notes”。 _notes是由dreamweaver生成的,不是项目本身的一部分,但这些目录分散在整个项目中。
不知何故 ^_notes$ 没有在 .hgignore 中完成这项工作...我是否必须将 .hgignore 定向到每个目录“_notes”还是递归地执行此操作?
我不太确定手册页
I want to ignore all directories "_notes" throughout a repository. _notes is generated by dreamweaver and is not part of the project itself, but these directories are scattered throughout the project.
Somehow ^_notes$ is not doing the job in .hgignore ... Do I have to direct .hgignore to each and every directory "_notes" or does it do it recursively?
I am not quite sure about the man pages
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
尝试:
我可能应该提到,如果已经添加了目录,则不能忽略它们。如果您使用的是较新的 Mercurial 版本,请使用 hg忘记,就是这种情况。
Try:
I should probably mention that if the directories have already been added you cannot ignore them. Use hg forget if you are on a newer Mercurial version, be this the case.
.hgignore
这不是特定于目录的,因此如果您有任何具有该确切名称的文件,它们也将被忽略。
例子:
.hgignore
This isn't specific to directories, so if you have any files with that exact name, they will be ignored too.
Example:
正如您的评论所揭示的那样,您无法使其工作的原因是存储库中已经存在的优先级高于 .hgignore。 (想象一下,如果 .hgignore 优先,可能会出现令人讨厌的问题!弄乱正则表达式,您可能会停止跟踪一半的存储库)
要从存储库中删除内容,您可以使用
hg remove
或hg忘记
(这是 hgremove -Af
的别名)。您可能想要使用hgforget
因为这会将其从存储库中删除,但不会删除本地副本;hg remove
也会(不带 -Af)删除本地副本As your comment reveals, the reason you can't get it to work is that already being in the repository takes precedence over .hgignore. (Imagine the nasty issues that could arise if .hgignore took precedence! Mess up a regexp and you might stop tracking half your repo)
To remove stuff from the repo you can use
hg remove
orhg forget
(which is an alias for hgremove -Af
). You probably want to usehg forget
as this will remove it from the repository but not delete the local copy;hg remove
will (without -Af) delete the local copy as well这将完成这项工作:
语法:regexp
/_notes/
如果您想检查存储库忽略了哪些文件,您可以尝试:
hg stat -i
这将列出 hg 通过 .hgignore 成功忽略的所有文件,这对于在向存储库添加任何内容之前进行调试非常有用。
!之前添加到存储库的文件将不会被忽略!
This will do the job:
syntax: regexp
/_notes/
In case you want to check what files are being ignored by your repository, you can try:
hg stat -i
This will list all files that are successfully ignored by hg through .hgignore, it is nice for debugging before you add anything to the repository.
!Previously added files to the repository will not be ignored!