» cargo publish
    Updating crates.io index
warning: manifest has no license, license-file, documentation, homepage or repository.
See https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info.
error: 1 files in the working directory contain changes that were not yet committed into git:

rusttermpose.sublime-workspace

每次我提交更改时提交此文件或将其删除都是很糟糕的选择。它在./.gitignore中列出,但是 cargo 似乎不在乎。我相当确定应该从历史上讲应该照看 cargo ,但是这将是一个奇怪的错误,因此我想我应该在报告之前询问是否丢失了某些东西。

该项目位于较大的git repo内的子目录(/rust/)中。

/rust/.gitignore和/.gitignore说
/rust/rusttermpose.sublime-workspace
rusttermpose.sublime-workspace
/rusttermpose.sublime-workspace
*.sublime-workspace

rusttermpose.sublime-workspace不在git的跟踪文件中
» git ls-files
Cargo.toml
README.md
examples/simple.rs
longterm.term
rusttermpose.sublime-project
sexp tests.sexp
shortterm.term
shortwood.sexp
src/lib.rs
src/parsers/mod.rs
src/parsers/termpose_parser.rs
src/parsers/woodslist_parser.rs
src/wooder.rs
tests.term
wood_derive/Cargo.toml
wood_derive/src/lib.rs

最佳答案

如果我正确理解了您的问题,则可以将其提及为:

# Workspace files
*.sublime-workspace

它将忽略all扩展名为.sublime-workspace的文件。

您还可以执行以下操作:
/rusttermpose.sublime-workspace

但不是:
./rusttermpose.sublime-workspace

即相对于您的根目录执行此操作。

您也可以这样做(忽略子目录中的文件):
**/*.sublime-workspace

或(包括当前目录)
**.sublime-workspace

如果不确定确切的目录结构。

关于git - cargo 发布不会忽略.gitignore中的文件,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/56033011/

10-14 16:14
查看更多