使用 Mercurial 忽略 manage.py (hg .hgignore)

发布于 2024-10-18 14:45:40 字数 248 浏览 4 评论 0原文

我在 Django 项目中使用 Mercurial,并且我需要忽略 manage.py。 当我对 settings_local.py 进行更改时,我的 .hgignore

syntax: glob
*.pyc
*.html~
*.js~
manage.py
settings_local.py
media/

工作正常,但是当我更改 manager.py 时,.hgignore 不起作用

提前致谢!

i'm using mercurial for my project in Django, and i need to ignore the manage.py. I've my .hgignore like this

syntax: glob
*.pyc
*.html~
*.js~
manage.py
settings_local.py
media/

when i make changes to settings_local.py it working fine, but when i change manage.py the .hgignore does not work

Thanks in advance!!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

怀念你的温柔 2024-10-25 14:45:40

.hgignore 文件仅告诉相关命令,以避免在您要求它们通过扫描目录并查找新文件和已删除文件来查找要添加到存储库的文件时拾取新文件。

我能记得的两个,可能还有更多,是:

hg addremove
hg commit --addremove

就这样了。如果您在告诉 Mercurial 忽略某个文件之前将其添加到存储库,或者在忽略该文件的情况下专门将其添加到存储库,则 Mercurial 将开始跟踪该文件。

一旦开始跟踪,就会继续跟踪。

换句话说,无论您是否在 .hgignore 中指定了该文件,以下命令都会要求 Mercurial 开始跟踪该文件:

hg add manage.py

无论您在编辑 .hgignore 之前还是之后执行此操作 文件无关紧要。

您的问题听起来像是 Mercurial 已经在跟踪此文件。要让 Mercurial 停止跟踪文件,请发出忘记命令:

hg forget manage.py

然后进行提交。此后,Mercurial 将不会拾取对该文件的更改。

The .hgignore file only tells relevant commands to avoid picking up new files when you ask them to find files to add to your repository by scanning the directories and finding new and removed files.

The two I can remember, there might be more, are:

hg addremove
hg commit --addremove

That's it. If you either add a file to the repository before you tell Mercurial to ignore it, or specifically add a file to the repository even though it is being ignored, then Mercurial will start tracking the file.

And once it has started tracking it, it will keep on tracking it.

In other words, regardless of whether you have specified the file in .hgignore, the following command will ask Mercurial to start tracking the file:

hg add manage.py

Whether you did this before or after you edited the .hgignore file is irrelevant.

Your question sounds like Mercurial is already tracking this file. To get Mercurial to stop tracking the file, issue a forget command:

hg forget manage.py

and then do a commit. After that, changes to that file will not be picked up by Mercurial.

沦落红尘 2024-10-25 14:45:40

Manage.py 是否位于根文件夹中,如果是,则在创建忽略文件之前将其添加到存储库中(因此它已被跟踪)。如果是第二种情况,那么只需告诉 Hg 忘记文件

hg忘记manage.py 是我相信的语法。

Is the manage.py in the root folder, and if so was it added to the repo before the ignore file was create (thus it is being tracked already). If the second is the case then just tell Hg to forget the file

hg forget manage.py is the syntax I believe.

成熟的代价 2024-10-25 14:45:40

只需确保您没有添加 .hgignore 文件即可。

如果您确实忘记了 .hgignore,然后再次提交。

这应该在下一次提交时忽略您的manage.py!

just make sure you've not added your .hgignore file.

If you did just forget .hgignore and then commit again.

This should ignore your manage.py with the next commit !

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文