A Git extension for managing repositories across multiple Git hosts and destinations.
git-fleet is a native CLI I'm building to simplify the Git workflows I use across self-hosted Git services and public hosts. The project started as a few personal scripts for configuring dual-push repositories and is being rebuilt in OCaml as a single, reusable command.
v0.2.0: remote management
git fleet status,git fleet addandgit fleet remove- Multiple push destinations on a single remote
- Preserves the destination a remote already pushed to
- Collapses redundant configuration back to plain Git behaviour
--dry-runon every command that changes something- Git is run directly, never through a shell
git-fleet configures ordinary Git remotes. A remote fetches from one URL and may push to several, which is how a repository stays mirrored across more than one host:
[remote "origin"]
url = [email protected]:user/project.git
fetch = +refs/heads/*:refs/remotes/origin/*
pushurl = [email protected]:user/project.git
pushurl = [email protected]:user/project.gitA remote with no pushurl pushes to the URL it fetches from. As soon as it has one pushurl, Git pushes only to the URLs listed there, so git fleet add writes out the existing destination before adding a new one. Removing a destination reverses that: when the only one left is the fetch URL, the redundant configuration is dropped.
Every command works on origin unless --remote says otherwise.
Show where a remote fetches from and pushes to:
git fleet status
git fleet status --remote upstreamorigin
fetch [email protected]:user/project.git
push [email protected]:user/project.git
push [email protected]:user/project.git
Add a destination. With neither --fetch nor --push, the URL is added as a push destination. A remote that does not exist yet is created:
git fleet add [email protected]:user/project.git
git fleet add [email protected]:user/project.git --fetch
git fleet add [email protected]:user/project.git --fetch --push
git fleet add [email protected]:user/project.git --remote upstreamRemove a push destination. URLs are matched exactly, as they appear in git fleet status:
git fleet remove [email protected]:user/project.gitPreview the Git commands instead of running them:
git fleet add [email protected]:user/project.git --dry-runWould change remote 'origin':
git remote set-url --add --push origin [email protected]:user/project.git
git remote set-url --add --push origin [email protected]:user/project.git
Commands exit with 1 and a single line on standard error when something is wrong, such as running outside a repository or naming a remote that does not exist.
Build a release binary and put it on your PATH:
dune build --release
install -Dm755 _build/default/bin/main.exe ~/.local/bin/git-fleetGit exposes any git-* executable on PATH as a subcommand, so git-fleet becomes:
git fleet --help
git fleet --versionInstall the project dependencies:
opam install . --deps-only --with-testBuild, test and run:
dune build
dune runtest
dune exec git-fleet -- statusThe tests create temporary repositories and never change the configuration of this one.
MIT