Backup your repository at configured intervals
demo.mp4
- highly configurable
- 0 external dependencies (except git)
- backup with the help of git, every interval
- inspired by obsidian-git and its automatic backup system
- alternative to obsidian git that does not require obsidian and is faster
- sane defaults
- JSON based configuration
XGS is a lot more minimal and configurable than git-auto-sync, doesn't require obsidian or VScode to work (Obsidian Git, VS Code GitDoc) and isn't as complicated or unintelligible as Git Annex or Git Sync.
Alternatives:
Requires:
- go
git clone https://github.com/xnacly/x-git-sync xgs
cd xgs
go build
./xgs # unix
xgs.exe # windows
- download executable from latest release
- move the
xgs
-executable to a directory in the path, for linux:mv ./xgs /usr/bin
(this might require elevated privileges)
Prerequisites:
-
git needs to be installed, xgs will panic if it isn't
- projects needs to be a git repository with a remote set up
- git user needs be authenticated to the remote
- you should be able to run the following commands in your project without issues before using xgs in it:
git add -A
git commit -m "test"
git push
- you can now use xgs in your project
- Navigate to the git project you want to backup
- run
xgs
in your terminal
If you have no
xgs.json
, xgs will use its default configuration.
- On Unix systems,
$XDG_CONFIG_HOME/xgs.json
or$HOME/.config/xgs.json
- On Darwin,
$HOME/Library/Application Support/xgs.json
- On Windows,
%AppData%/xgs.json
- On Plan 9,
$home/lib/xgs.json
If xgs can't find its config file (xgs.json
) it will fallback to its default config:
{
// specifies the date format which the date will be formatted as
//
// - 2006 for the year, 06 would only be the last two integer
// - 01 for the month
// - 02 for the day
// - 15 for the hour (24-hour format), 05 for 12-hour format
// - 04 for the minute
// - 05 for the second
//
// time formatting in go is weird, see docs:
//
// https://www.digitalocean.com/community/tutorials/how-to-use-dates-and-times-in-go
"commit_date": "2006-01-02 15:04:05",
// specifies the format of the commit, currently supports:
// - commit_date: %date%
"commit_format": "backup: %date%",
// List filenames affected by the commit in the commit body
// together with the type of change which happend to the file:
//
// Affected Files:
// <filename> <change>
//
// possible change types:
// - modified
// - added
// - renamed
// - deleted
// - copied
// - updated but unmerged
"add_affected_files": true,
// time interval between backups (in s)
"backup_interval": 300,
// commit command, which xgs runs after running `git add -A`
"commit_cmd": "git commit -m",
// enables debug mode (verbose logging, extra infos, etc.), default: false
"debug": false,
// enables pulling the latest changes from remote on start, default: true
"pull_on_start": true
}