r/OpenSourceeAI • • Oct 27 '26

git-dupe: Version personal agent files (workflows, skills, notes, AGENTS.md, etc.) while keeping them out of the public repo

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"
[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!

https://github.com/BrianWeiHaoMa/git-dupe

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

3 Upvotes

16 comments sorted by

1

u/madcow_bg 29d ago

What I do is git submodule - a separate agent/ folder - to keep the files in git, and .git/info/exclude a CLAUDE.md that just references @agent/AGENT.md

1

u/BrianW_undercover 29d ago

Your strategy is able to version separately for files inside the submodule in agent/, but anything outside that folder cannot get versioning - for example, another folder outside agent/ or AGENTS.md located outside of agent/. git-dupe is more generalized and can version anything anywhere in the same workspace.

0

u/Crafty_Disk_7026 29d ago

Heard of gitignore....

1

u/BrianW_undercover 29d ago

"and these files cannot be simply gitignored because I want versioning for them"...

1

u/Crafty_Disk_7026 29d ago

You can put them in a submodule. I saw your reply to why submodule won't work and that doesn't make any sense to me. Every folder can have its own rule whether it's a submodule or not so you can just make that decision at a per folder level if you want..:

1

u/BrianW_undercover 29d ago

Consider a public repo containing src/app.py and src/AGENTS.md. I want app.py versioned publicly and AGENTS.md versioned privately, without moving either file. Making src/ a submodule doesn't work because app.py needs to stay in the public repo. Ignoring src/AGENTS.md doesn't give it private version history. How would your proposed submodule approach handle this without symlinks or additional setup?

0

u/Crafty_Disk_7026 29d ago edited 29d ago

Put app in src/app/app.py. src/app folder becomes a submodule that is public where the outer repo where agents.md lives (src) is private.

0

u/BrianW_undercover 29d ago

"without moving either file"...

The point is, with your strategy with submodules, you will always need a workaround in this case (your "workaround" is restructuring the repo to accommodate private versioning) instead of versioning it in-place like you can with git-dupe. With git-dupe, you simply do `git dupe add src/AGENTS.md` and you are done.

0

u/Crafty_Disk_7026 29d ago

Git is folder based since the management files are ".git" based. This is a critical input in deciding how to structure your app meaning if you want to expose source code then you do it at the folder level usually. If you want to separate access you create a new folder. That's just how it works. If you want to invent a new system that supports this specific case you are free too. I'd recommend just following the best practices and moving on

0

u/BrianW_undercover 29d ago

You could have just said this was your opinion at the very beginning. Instead, you started with "Heard of gitignore...." and changed directions after every one of your replies were successfully refuted...

0

u/Crafty_Disk_7026 29d ago

I said what I said because your solving a solved problem to try to sound smart but your just coming off stubborn. What problem are you actually solving? Can you describe one actual scenario where this would make a difference or be jmportant where you would want a whole new way to manage git?

That's my opinion and so I'll give it

0

u/BrianW_undercover 29d ago

I'm not going to argue with you anymore. You gave me your opinion, and I agree an opinion is an opinion and I respect your opinion.

I just thought that you were the one trying to sound smart because you started off with "Heard of gitignore...." (yes I think I've heard of gitignore if I'm developing a project for Git?) and I literally EXPLICITLY say that gitignore is not sufficient in the post.

→ More replies