A compact PowerShell toolkit for managing Git-based modular repositories. It includes two key scripts:
- Install-Manager.ps1 – bootstraps and exposes the manager as a git submodule.
- GitPackageManager.ps1 – installs, restores, updates, or removes repositories defined in a manifest.
Together they provide a deterministic, CI-friendly workflow for external dependencies.
This project provides an easy, reproducible way to manage submodules and external Git repositories using manifest files.
- Manifest-based control: Define modules (repositories) declaratively in JSON.
- Lockfile support: Track exact commits for deterministic builds.
- Cross-platform: Works with PowerShell 5.1+ or PowerShell 7+.
- Automation-ready: Suitable for CI/CD pipelines and local development.
All documentation for the individual tools lives under the ./docs folder:
-
Copy
Install-Manager.ps1into your repo root. -
Run (accepting defaults):
pwsh ./Install-Manager.ps1
-
Commit the staged changes:
git commit -m "Install Git Package Manager submodule and expose tools/GitPackageManager.ps1" git push
-
Use the manager:
pwsh ./tools/GitPackageManager.ps1 -Command restore pwsh ./tools/GitPackageManager.ps1 -Command install -Commit pwsh ./tools/GitPackageManager.ps1 -Command update -Name some-module -Commit pwsh ./tools/GitPackageManager.ps1 -Command remove -Name some-module -Commit
- PowerShell 5.1+ or PowerShell 7+
- Git 2.23+ recommended (falls back for older)
- Execute at repo root
config-specification.json # manifest you edit
config-specification.lock.json # lockfile script writes
tools/GitPackageManager.ps1 # script (path arbitrary)
{
"modules": [
{
"name": "sub-module-demo",
"repo": "https://github.com/g4-api/sub-module-demo.git",
"localPath": "submodules/sub-module-demo",
"tag": "v1.0.0",
"submodule": true
}
]
}# Install all modules and write lock
.\tools\GitPackageManager.ps1 -Command Install
# Update according to manifest (refresh lock)
.\tools\GitPackageManager.ps1 -Command Update
# Restore exact state from lock file
.\tools\GitPackageManager.ps1 -Command Restore
# Remove modules (folder or submodule)
.\tools\GitPackageManager.ps1 -Command RemoveFilter a single module:
.\tools\GitPackageManager.ps1 -Command Update -Name "sub-module-demo"Help:
.\tools\GitPackageManager.ps1 -Command HelpEach includes full command documentation, manifest format, and troubleshooting.
Apache-v2.0 License © G4 Automation Platform