https://github.com/remram44/doublegit
A command line tool to mirror a repository, logging all ref updates
https://github.com/remram44/doublegit
archive git github hacktoberfest rust
Last synced: 4 months ago
JSON representation
A command line tool to mirror a repository, logging all ref updates
- Host: GitHub
- URL: https://github.com/remram44/doublegit
- Owner: remram44
- License: mit
- Created: 2019-03-16T03:03:00.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-06-14T16:10:34.000Z (over 2 years ago)
- Last Synced: 2025-07-19T11:43:23.904Z (4 months ago)
- Topics: archive, git, github, hacktoberfest, rust
- Language: Rust
- Homepage:
- Size: 211 KB
- Stars: 8
- Watchers: 3
- Forks: 4
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
What is this?
=============
This is a small tool that does `git fetch` then writes down all ref updates in a SQLite3 database. It also creates refs to make sure no commit gets garbage collected.
What for?
=========
If the remote repository gets force-pushed to, some commits might get lost. There will also be no evidence in the Git log that such destructive changes happened. It is also possible for a commit to be created but pushed much later, or branches can get renamed; none of this appears in the Git log either.
This tool will allow you to get a clear picture of what happened, never lose a commit, and quickly get a snapshot of a repository at a specific point in time. It is therefore more suitable for backups than a mirror.
Doesn't the reflog do all that?
===============================
This is indeed similar to Git's built-in reflog, except that the reflog isn't aware of branch renames, and a branch's reflog gets deleted with the branch.
It is also local, so you wouldn't be able to read the reflog of a remote repository.
How to use
==========
First, create a bare repo::
```
$ mkdir my-repo-backup && cd my-repo-backup
$ git init --bare
```
Set up a remote `origin`:
```
$ git remote add origin https://github.com/my-name/my-repo.git
```
Then simply run doublegit once in a while:
```
$ doublegit /path/to/my-repo-backup
```
You can then query `gitarchive.sqlite3` for branch updates or for the position of the branches at a given point in time.
Next steps?
===========
I think it would be cool if this tool could record GitHub/GitLab/... API events too; things like issues/merge requests/comments.
It could also automatically backup all your starred repos.
Some kind of query interface needs to be written (I'm thinking web).