summaryrefslogtreecommitdiff
path: root/README.md
blob: ed6980d820cbd70b9725c42b4e9a0056f552c4dc (plain)
# git-autosave

Autosave for Git! `git-autosave` will push your changes to a custom ref on the `origin` remote whenever you make changes. This ref is not a branch, and it especially is not on the current branch. It will not appear in Codeberg or GitHub, but it will still be accessible to `git-autosave`.

## Build/Installation

If you have Cargo installed, you can install `git-autosave` from source.

```
$ cargo install --git https://codeberg.org/botahamec/git-autosave.git
```

## Usage

To initialize a repository with `git-autosave`, run `git init-autosave`

```
$ git init-autosave
Initialized autosave for repository: b0723f0e-df02-47dc-aac9-a5653f6a3a89
```

This ID is unique to your instance of the repository. If you clone the repository to another device or directory, then you'll need to run `git init-autosave` again.

To run a manual autosave, run `git autosave`.

To restore from an autosave on another device, run `git restore-autosave`. This will pick an autosave automatically if there is only one option from another device for the same user. If you'd like more options, use `--all-branches`, `--all-users` and `--all-devices`. You can use `git diff-autosave` to preview an autosave before restoring it.

To undo a `restore-autosave` operation, use `git undo-restore-autosave`.

### Background save

**Important:** In order to allow `git-autosave` to automatically push to the remote over SSH, you'll need to have your SSH password saved either in your gnome-keyring or kdewallet or equivalent.

The `scripts` subdirectory of this repository contains configurations for both systemd and runit which will run `git autosave-daemon` in the background.

For systemd (most Linux systems), copy `scripts/git-autosave.service` into `~/.config/systemd/user/git-autosave.service`.