README file from
GithubGit Subbridge
A customized Git plugin for Obsidian that solves the problem of uploading or committing nested sub-repositories.
Features
- Adds a Sub-git scan button to the Source Control toolbar, immediately to the left of Commit-and-sync.
- Scans the repository for child folders containing
.git. - Supports Exclusive rename mode, which keeps only
.gitor.git_metadata. - Supports Sidecar copy mode, which keeps both directories and avoids Windows directory-lock errors.
- Adds a Nested repositories settings section with bridge, metadata-mode, and language options.
- Language: 中文 translates the settings page and adds Chinese translations to button tooltips.
- Writes a recovery journal so interrupted operations can be restored on the next startup.
How it works
In Exclusive rename mode, .git is renamed to .git_metadata before the commit and renamed back afterward. In Sidecar copy mode, only .git/HEAD is temporarily renamed, the metadata is copied to .git_metadata, and both directories remain.
Scan child .git
-> rename .git/HEAD to HEAD__subbridge
-> copy .git to .git_metadata
-> stage and commit with Obsidian Git
-> restore .git/HEAD
The bridge currently covers the Commit all path used by Commit all and the default Commit-and-sync action. Staged-only commits are not automatically bridged.
For a detailed comparison, see Metadata modes.
Build and install
pnpm install --frozen-lockfile
pnpm run build
Copy main.js, manifest.json, and styles.css into:
.obsidian/plugins/git-subbridge/
Then enable Git Subbridge in Obsidian. Disable the original Git plugin while using this plugin so both plugins do not operate on the same repository at the same time.
Usage
- Open the Source Control view.
- Click the Sub-git scan button to check for child Git repositories.
- Run Commit all or Commit-and-sync.
- The plugin bridges child
.gitfolders, commits the parent repository, and restores the original folder names.
Safety notes
- This plugin is desktop-only and currently intended for Windows.
- Do not run Git commands inside a child repository while it is being bridged.
- Keep enough free disk space for Git index metadata and recovery operations.
- Do not run Git commands inside a child repository while Commit-and-sync is preparing or restoring it.
Author
- Name: 一只朱
- GitHub: zhu1j
- Email: [email protected]
License
This project is distributed under the MIT License. See LICENSE.