Synchronize a subdirectory of your repository with an external repository using a simple GitHub CLI extension. gh-sync wraps git subtree
so that you can easily pull and push changes while keeping track of the mapping in your Git configuration.
- connect – register a subdirectory ↔ remote URL mapping
- pull – fetch from the remote and update the subtree (supports
-m
for merge message) - push – push local changes in the subtree back to the remote (supports
-m
for commit message) - list – show current mappings
- remove – delete a mapping
These commands make it straightforward to synchronize only a portion of a large repository with another repository.
Install locally using Cargo:
cargo install --path .
Or install as a GitHub CLI extension:
gh extension install ackkerman/gh-sync
# Register a mapping (once)
gh sync connect web-app git@github.com:ackkerman/nlo.git --branch dev_ui
# Pull updates from the remote (customize merge message with -m)
gh sync pull web-app -m "Update from remote"
# Push local changes back
gh sync push web-app -m "Sync subtree"
# View mappings
gh sync list
# Remove a mapping
gh sync remove web-app
Mappings are stored in your repository's Git configuration under the gh-sync
prefix. Multiple subdirectories can be managed.
MIT