Skip to main content

Metagit

Git for Git Repositories


If you:

  • have a directory full of Git repos
  • want to version-control the configuration of those repos
  • like Git

Then you might find Metagit useful. It offers a Git-like experience for managing Git repos.

Demo

Initialize a Metagit repository:

$ cd ~/projects/    # or wherever you store your Git projects, or use metagit -C
$ metagit init      # creates .metagit, a Git repo where tracked project configs are kept
Initialized Metagit repository in /home/dmtucker/projects
$ metagit status
Untracked projects
  (use "metagit add <project>..." to begin tracking)
	project1/
	project2/

Track changes to project config:

$ metagit add project1/ project2/    # start tracking some projects
$ git -C project1/ remote add foo git@somehost.com:foo/project1.git
$ rm -rf project2/
$ metagit status
Changes
  (use "metagit add/rm <project>..." to accept changes)
  (use "metagit restore <project>..." to undo changes)
	modified: project1
	deleted:  project2

Git tracks lines in files. Metagit tracks config in projects.

$ metagit diff
diff --git a/project1 b/project1
index 515f483..93a874c 100644
--- a/project1
+++ b/project1
@@ -3,3 +3,6 @@
 	filemode = true
 	bare = false
 	logallrefupdates = true
+[remote "foo"]
+	url = git@somehost.com:foo/project1.git
+	fetch = +refs/heads/*:refs/remotes/foo/*
diff --git a/project2 b/project2
deleted file mode 100644
index 515f483..0000000
--- a/project2
+++ /dev/null
@@ -1,5 +0,0 @@
-[core]
-	repositoryformatversion = 0
-	filemode = true
-	bare = false
-	logallrefupdates = true

This example deleted project2 so as to demonstrate metagit restore (below), but keep in mind, ONLY CONFIGURATION IS TRACKED. If you need all of project2 back, you should restore from a backup.

$ metagit restore project2  # only restores git config! not branches/tags/etc.
$ metagit add project1      # add the project again to keep the changes
$ metagit rm project1       # stop tracking a project (does not affect the actual project)

About .metagit

.metagit is just another Git repo in your projects folder. It is created by metagit init, which automatically starts tracking it. When metagit add is used to start tracking a project, that project's .git/config file is copied into .metagit and committed.

$ git -C .metagit log
36cec91 (HEAD -> master) Remove project1
a1ed312 Add project1
185ed15 Add project2
e4d274d Add project1
1e16b5e Add .metagit

Pro tip: Consider a clone of the .metagit repo a (Metagit) "clone" of your projects folder. For example, push the .metagit repo to GitHub to allow for easy provisioning of new dev machines:

$ mkdir ~/projects
$ cd ~/projects/
$ git clone git@github.com:dmtucker/.metagit.git
...
$ metagit restore project2

Metadata

Release files for metagit 1.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metagit 1.4.0
File Size Uploaded Provenance
metagit-1.4.0.tar.gz 26.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for metagit 1.4.0
File Interpreter ABI Platform
metagit-1.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.9 kB

Release files / metagit-1.4.0.tar.gz

Download URL metagit-1.4.0.tar.gz
Size 26.0 kB
Tags Source
SHA-256 checksum
How to use checksums
e02f90b0c070c20dbcedb5028c9387fb50e622ee84fc1c54d2c21b252b6d9292
BLAKE2b-256 checksum
How to use checksums
06d44827854f3c52a4164f779b00af512761478025b38413df1a3b1ee8bd015b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/37.1 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.12.0 keyring/23.9.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.10.6

Release files / metagit-1.4.0-py3-none-any.whl

Download URL metagit-1.4.0-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b756cb97fb5f438d4d4b2b666e1092b036f375b5e6fddb8566a82e9a02c24211
BLAKE2b-256 checksum
How to use checksums
9af2f31aac165c7473c2b6dc623ab3e0daa6234f90e31cd076176fcb72430c7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/37.1 requests/2.28.1 requests-toolbelt/0.9.1 urllib3/1.26.12 tqdm/4.64.1 importlib-metadata/4.12.0 keyring/23.9.0 rfc3986/2.0.0 colorama/0.4.5 CPython/3.10.6

Security for metagit 1.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page