It may not always be possible to publish Git repositories on GitHub, though it may still be desirable to see personal work on these repositories reflected in a GitHub contributions graph.
git-squares enables this by mirroring minimal commit data from any number of local repositories to one (or more) repositories pushed to GitHub for the sole purpose of providing input for GitHub contribution graphs.
The only data exported from local repositories are:
- commit hashes; and
- commit times.
No other potentially sensitive data is exported - no repository names or paths, no branch or tag names, no commit messages or content, no author or committer details, etc.
The only dependency for this project is libgit2.
git-squares can be built and installed from a fresh clone of this repository using the following commands:
$ autoreconf -i
$ ./configure
$ make
$ make install
This will install the git-squares
binary which can be invoked directly, or -
if installed to a location specified in $PATH
- indirectly via git
itself:
$ git squares command [args]
git-squares can manage its data in any repository, though a dedicated
repository - e.g., user/squares
- is strongly recommended.
This repository, in Github, may either be public or private (if the "Include
private contributions on my profile" option is selected).
The only requirement is that this squares repository have at least one commit. Commits created by git-squares may be intermingled with any other commits and so this repository can simply start with an empty initial commit.
Commits from any number of local repositories may be imported by running:
$ git squares import [--squares-repo REPO] [--squares-branch BRANCH] \
> [--author AUTHOR] REPO ...
This will scan all branches in all specified repositories for commits by the
given AUTHOR
that aren't present in the squares repository
and create a new commit in the squares repository for each one found (on
BRANCH
if specified, otherwise the current HEAD).
If --squares-repo
is not specified then a default value of .
is used.
AUTHOR
may be specified as a name or email address; if
AUTHOR
is not specified, the value of
git config --get user.name
(as configured for the squares repository) is used
as a default.
As commit hashes are recorded in the squares repository this command can be run against the same local repositories multiple times without creating duplicate commits in the squares repository.