.gitignore 模板镜像,供 cnb-rs repo gitignore 命令使用。
| 项 | 值 |
|---|---|
| 上游 commit | ca6c873 |
| 同步时间 | 2026-05-17 23:00:08 +08:00 (Asia/Shanghai) |
| 模板数量 | 238 |
| 子集 | 上游 | License |
|---|---|---|
| 主流语言 / 框架 | github/gitignore 根目录 | CC0-1.0 |
| OS / 编辑器 / 工具链 | github/gitignore Global/ | CC0-1.0 |
github/gitignore 的 community/ 子目录(社区贡献模板)未收录,与 GitHub CLI 行为一致。
每个模板平铺在仓库根目录,文件名 <Name>.gitignore,与上游保持一致。
冲突处理: 若同名文件同时存在于 root 与 Global,取 root 版本(与 GitHub CLI gh repo gitignore 行为一致)。
# 列出所有可用模板(自动剥除 .gitignore 后缀)
cnb-rs repo gitignore list
# 查看指定模板内容(裸名 / 带后缀均可)
cnb-rs repo gitignore view Rust
cnb-rs repo gitignore view Node.gitignore
# 直接写入到当前目录的 .gitignore
cnb-rs repo gitignore view Rust > .gitignore
需要 Python 3.8+ 和 git 在 PATH。脚本只用标准库,无需 pip install。
# 默认从 GitHub 直连
python3 seed.py
# 或指定镜像(国内场景)/ 已有的本地 clone
python3 seed.py --upstream https://kkgithub.com/github/gitignore.git
python3 seed.py --upstream /path/to/local/github-gitignore-clone
git status # 检查改动
git diff README.md # 重点确认 README 元数据段
git add -A
git commit -m "chore: sync templates from upstream"
git push
seed.py 会:
_upstream/(远端 URL 走 --depth=1,本地路径全量 clone;目录被 .gitignore 忽略)*.gitignoreBEGIN_UPSTREAM_STATUS ... END_UPSTREAM_STATUS 段_upstream/执行后请 git diff 检查改动再 push。