git - cargo publish 不会忽略 .gitignore 中的文件

标签 git rust rust-cargo

» 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 存储库内的子目录 (/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

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

您还可以:

/rusttermpose.sublime-workspace

但不是:

./rusttermpose.sublime-workspace

即相对于你的根。

你也可以这样做(忽略子目录中的文件):

**/*.sublime-workspace

或者(包括当前目录)

**.sublime-workspace

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

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

相关文章:

git - 开源项目时处理以前的提交

git:冲突后将文件的不同阶段存储在索引/工作树中

reference - 从作为参数传递给函数的引用返回内部引用时的生命周期处理

generics - 带有通用参数的 to_string

rust - 在嵌套循环中从 BufReader 读取时出错

git - 可能通过 git 丢失了一些更改

Git 孤儿分支 "This branch is 1 commit ahead, n commits behind master"

rust - 如何将 rust snafu 错误枚举移动到一个模块中并从另一个模块中使用它?

api - 我正在尝试通过 Rust 中的 OpenWeather API 获取数据,但我想我正面临一些关于解析的问题

rust - 使用网络浏览器下载 Rust crates