NAME

git-unify - Share .git directory among local repositories of same origin

SYNOPSIS

git unify init
git unify deinit
git unify clone <repository> [<path>]
git unify submodule-add <repository> [<path>]
git unify submodule-update [<path>]
git unify shared-dir [--verify]

DESCRIPTION

Shares files under .git directory among local repositories to squeeze disk usage and/or speed up clone speed. Especially useful for example if you have many repositories that uses same submodules.

COMMANDS

init

Share files (eg. refs, objects) of repository’s .git directory under "$HOME/.shared-git" (by default) so that other local clones of the same origin can use shared files there. The files are moved to central and symlink to them are placed under local .git directory.

If shared .git directory is already set up and the shared refs are not fast-forward of local refs, this command will fail. If so, push your local changes to remote (if any), and run command below to make shared refs up-to-date.

$ git push origin the-branch
$ git unify update-shared-branch the-branch
deinit

Reverts the effect of git unify init. Files under .git directoy are no longer shared (not symlinked).

clone

Does git clone with shared .git directory used/set up. If the remote repository is already shared (git unify init is done somewhere), it does not fetches remote directory but instead clones from the shared .git directory.

submodule-add

Does git submodule add with shared .git directory used/set up.

submodule-update

Does git submodule update --init with shared .git directory used/set up.

shared-dir

Prints shared .git directory for current repository. Exits with non-zero code if --verify is specified and the directory does not exist.

SHARING .git DIRECTORIES

git-unify shares .git/refs, so local repositories of same origin that are unified shares their branches. Branch updating at one working directory would affect the other.

AUTHOR

Written by motemen <motemen@gmail.com>