git-syncing

Preface

To keep org files sane and in check you need an auto-syncing solution, capable of competently merging separate notes on machines together.

Solutions

In terms of solutions we have:

Service

git-sync bg runner

TODO

Code

#tangle syncer.fish

function syncer -d "sync remote periodically with notifications"
  while true
    nix run nixpkgs#git-sync
    set time "$(date +"%R %D" )"
    set sleep "$(math 60x 60)"
    if test $status -eq 0
      notify-send "git sync" "Sync successful at $time"
    else
      notify-send -t $(math 1000x 60x 2) -u critical "git sync" "Sync failure at $time"
    end
    echo "time: $time, next in $sleep seconds"
    sleep "$sleep"
  end
end

Remote Login

A good way of login is ssh-agent. You can even have fine grained SSH identities on github for repos read/write access!

git-sync

Works in weird ways. Requires all changes to be unstaged before committing - huh. One nice idea is canceling commit when new files are present - #...# bullshit from emacs or result symlink from nix. While nice in theory, it can get cumbersome always calling git-sync -n on new files, which is a frequent occurance when doing notes. How about a patch that allows new files only if they are staged?

Options