
Git-dupe:用纯 Git 为 agent 文件实现项目内私有版本管理
来源标题:Show HN: Git-dupe – plain Git per-project private versioning for agent files
开发者发布 Git-dupe,在公共仓库内为 AGENTS.md、notes 等个人工作流文件建立独立的私有 Git 版本控制。它通过 git dupe 子命令创建独立仓库并自动隐藏这些文件,使其不被主仓库提交,同时保留版本历史。文件仍保留在工作区原位置,无需依赖 gitignore 舍弃版本追踪。
以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。
HN 的各位好!假设你有一些笔记、skill 和 agent 指令,它们是你个人工作流的一部分,所以你不希望把它们提交到公开仓库;但同时,你又希望它们出现在工作区的正确位置上(比如 AGENTS.md 文件的位置是有讲究的),而且这些文件不能简单地加进 gitignore,因为你还想对它们做版本管理。这个问题的解决办法,其实只是多用一点原生 Git。
$ git status --short # 公开仓库
?? AGENTS.md
?? notes/
$ git dupe init # 私有仓库
Initialized empty Git repository in /home/brian/code/project/.git/dupe/
$ git dupe add notes/ AGENTS.md # 私有仓库
hint: notes is now hidden from the project's Git; run from the root, 'git dupe unhide -- notes' stops hiding it
$ git dupe commit -m "Notes and agent instructions" # 私有仓库
[main (root-commit) 3eb3af9] Notes and agent instructions
3 files changed, 3 insertions(+)
create mode 100644 .gitdupe
create mode 100644 AGENTS.md
create mode 100644 notes/todo.md
$ git status --short # 公开仓库:什么都没有
$ git dupe log --oneline # 私有仓库:你的文件
3eb3af9 Notes and agent instructions
简而言之,解决办法就是把这些 agent 文件放到一个仓库里做版本管理——这个仓库是私有的,保存你 agent 文件的历史记录——并让这个仓库与公开仓库共用同一个工作树。你实际上是把两个仓库重叠起来,把私有仓库放在 .git/ 里(而这个 .git/ 就是公开仓库的 .git/),从而得到一个方便的解决方案。如果你想进一步了解所采用的策略,仓库里有更详细的文档。git-dupe 支持 macOS、Linux 和 Windows,采用 MIT 许可证。
评论 URL:https://news.ycombinator.com/item?id=50442093 点数:1 评论数:0
正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。