簡體   English   中英

.gitignore 忽略匹配模式的目錄/包

[英].gitignore ignore directories/packages matching patterns

所以,我試圖排除我項目中的所有 python 包。

例如-

project/
|--- dir1/
|    |-- pymysql/
|    |-- PyMySQL-0.8.0.dist-info/
|
|--- dir2/
|    |-- pymysql/
|    |-- PyMySQL-1.8.0.dist-info/

現在我需要忽略我所有目錄中所有pymysqlPyMySQL (不管 dist 版本如何)的出現。

.gitignore*pymysql/*PyMySQL*/在這里似乎工作正常。

但是,有沒有更好/有效的方法來做到這一點,因為我的項目中可以有任意數量的包 - 在這種情況下,我必須在我的.gitignore中對每個包進行硬編碼。

我只需要知道是否有更簡單的方法來排除.gitignore項目中所有可能的 Python 包。

您可以檢查典型的Python.gitignore文件,但像您一樣使用 glob 模式(前提是您知道一致的命名約定)是一個好的開始。
然后提到的 .gitignore 確實添加了其他文件夾:

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

我對此進行了測試, *pymysql/*PyMySQL*/似乎確實有效。 現在我只需要知道是否有一種更簡單的方法來排除.gitignore項目中所有可能的 Python 包。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM