NewsLab
Oct 27 17:39 UTC

Show HN: git-dupe – Version private files alongside a public Git repo (github.com)

3 points|by WayHow||2 comments|Read full story on github.com
Hi HN!

I made git-dupe to solve the problem where I have notes, skills, and agent instructions that are part of my personal workflow, so I do not want them committed to the public repo, but at the same time, I want them to be in the project at the correct locations (e.g., AGENTS.md file locations matter), and these files cannot be simply gitignored because I want versioning for them.

The solution that I've come upon is versioning those agent files in another repo, say <private-repo> (this repo is private to me and holds the history for my agent files). The project itself is open to the public in another <public-repo>. I overlap the two repos to solve the problem (i.e., they share the same worktree).

  $ git status --short              # the public repo
  ?? AGENTS.md
  ?? notes/

  $ git dupe init                   # the private repo
  Initialized empty Git repository in /home/brian/code/project/.git/dupe/

  $ git dupe add notes/ AGENTS.md   # the private repo
  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"        # the private repo
  [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              # the public repo: nothing

  $ git dupe log --oneline          # the private repo: your files
  3eb3af9 Notes and agent instructions
In short, git-dupe allows two Git repos to share the same worktree, while using native Git for most operations. Most git-dupe commands behave just like normal Git commands, operating on the private repo instead.

git-dupe currently supports Linux and macOS, and is under the MIT License; the git-dupe repo contains much more extensive technical documentation documentation for those who are interested. If you have any feedback/questions about git-dupe, feel free to message. I hope it helps!

Fun fact: the git-dupe project itself is using git-dupe for versioning.

Comments (2)

2 shown
  1. 1. ptkachykby||context
    Also, if you use Claude Code, it reads a gitignored CLAUDE.local.md next to CLAUDE.md, so you don't need a second repo. For worktrees, import one file from your home directory: @~/.claude/my-project-instructions.md

    The hardest part is keeping the information true in all of these prompts as the project evolves. We built Substrate for that: one memory outside of any agent that Claude Code, Codex and Cursor read, where every fact keeps its source.

    Do your agent files drift between tools? https://trysubstrate.co/l/a3hn

  2. 2. WayHow||context
    I use Claude Code. If you gitignore CLAUDE.local.md, you won't have versioning/history for that file (which you will have if you use git-dupe).

    git-dupe also supports linked worktrees.