Skip to content
BrianWeiHaoMaPublic

About

Plain Git versioning for the files that are yours, not the project's: notes, scripts, skills, and agent instructions, all hidden from the project's git while still getting their own history.

Topics

Resources

Contributing

Stars

22 stars

Watchers

1 watching

Forks

Repository files navigation

git-dupe

CI Latest release License: MIT

git-dupe is a second Git repository for the files in a checkout that are yours and not the project's: notes, plans, scratch scripts, editor settings, the instructions and skills you keep for a coding agent. The files stay where their tools expect them in the working tree. Their history lives in a repository of their own inside the project's .git, hidden from the project's git status and git add -A, and moves between your machines through a remote of your own. You already know how to drive it: public work is git …, your own is git dupe …, with Git's own commands, options, output, and exit codes.

A terminal transcript, each command followed by a comment naming the repository it acts on. git status --short, on the public repo, lists AGENTS.md and notes/ as untracked. After git dupe init, git dupe add notes/ AGENTS.md, and git dupe commit -m 'Notes and agent instructions', each on the private repo, git status --short on the public repo prints nothing, and git dupe log --oneline on the private repo shows that one commit.

Install

On x86-64 or ARM64 Linux, or on macOS, with Git 2.43.0 or newer, below 3.0.0:

curl -fsSL https://raw.githubusercontent.com/BrianWeiHaoMa/git-dupe/main/install.sh | sh

It puts the latest release's executable in ~/.local/bin and its manual page in ~/.local/share/man/man1, once the download matches its published digest.

On Windows 11 on x86-64, in PowerShell, with Git for Windows of the same versions:

irm https://raw.githubusercontent.com/BrianWeiHaoMa/git-dupe/main/install.ps1 | iex

It puts git-dupe.exe in ~\.local\bin, once the download matches its digest, and prints the line that puts that directory on PATH, changing no setting of yours. Installing has the rest: the archives by hand, from source, the Git it needs, what Windows differs in, and uninstalling.

Quick start

In a clone of a project, from the root, with notes/ a directory of yours and AGENTS.md your instructions for a coding agent, neither of them the project's. <url> is a repository of your own on a host or a disk you trust, created empty, with no README, license, or ignore file; on a disk, git init --bare -b main makes one for a project on main. A URL of the project's repository, or of any of its remotes, is refused.

git dupe init
git dupe add notes/ AGENTS.md
git dupe commit -m "Notes and agent instructions"
git dupe remote add origin <url>
git dupe push -u origin HEAD

On another machine, in a clone of the project, the files come back; -b <branch> after <url> names the project's branch where <url>'s default branch is another:

git dupe clone <url>

From then on, git dupe pull and git dupe push move your work between machines. A file the project's .gitignore ignores is added with -f, as git add adds one.

Things to know

  • It is Git. Every command but the few below is Git's own, with Git's options, output, and exit status, run against the dupe; Git's global options go before dupe.
  • Seven commands added: init and clone attach the dupe and detach removes it, hide and unhide edit the list of hidden paths, git runs Git against the dupe with no guard, and help prints the texts.
  • Three commands changed: status and add act on the hidden paths instead of every file of the project, and clean cleans the project while sparing them.
  • A few forms refused: stash -u and -a, which would stash the whole project, and a push, pull, fetch, remote, or clone naming the project's repository or any of its remotes. git dupe git <words> runs them when you mean it.
  • Plain git is not guarded. To the project's Git your files are ignored files: git clean -x deletes them, git stash -a stashes them, git add -f makes them public, and a public pull or checkout that brings a file to one of their paths overwrites yours. Commit first: git dupe restore :/ brings back every file the dupe tracks as last staged from any directory, over the project's file too where the project now tracks the path, which a public git add then stages; there, read yours with git dupe show HEAD:<path> instead, and restore the other paths by name. npm pack and a Docker build never read .git/info/exclude, and take them unless their own ignore files leave them out (Limits).
  • Each worktree on its own. A linked worktree is attached by its own git dupe init or git dupe clone, and git worktree remove and git worktree prune delete its dupe with it, whatever files of yours stand there. A push alone misses a file in no commit and a stash entry: Questions has the order to follow first.
  • Nothing is encrypted. Push to a remote you would trust with the files.

More of what it does not do is under Limits, and git dupe detach takes it back out, leaving every file on disk.

Read more

  • How it works: the dupe, the hidden paths, what git-dupe writes, its limits, and the specification it is built to.
  • What it is for: the uses it was made for, and how it compares with what you may already use.
  • Questions: worktrees, teams, clones, and getting out.
  • Installing: the scripts, the archives by hand, from source, and the Git it needs.
  • git dupe help, and git dupe help <command> for each command git-dupe adds or changes: a screen each, from the executable alone.
  • man git-dupe, where the manual page is installed, which is not on Windows: the commands, a quick start, examples, and explanations.
  • PRODUCT_SPECIFICATION.md: what git-dupe does and guarantees, and what it does not; TECHNICAL_SPECIFICATION.md: how each guarantee holds.
  • CONTRIBUTING.md: what governs a change, how to report a problem, and how to run the checks; CHANGELOG.md: what changed in each release; RELEASING.md: what a release holds and how one is made.

License

MIT, in LICENSE.

About

Plain Git versioning for the files that are yours, not the project's: notes, scripts, skills, and agent instructions, all hidden from the project's git while still getting their own history.

Topics

Resources

Contributing

Stars

22 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages