34

How can I keep my .org files up to date across several computers, perhaps across multiple platforms(linux/windows)?

I could keep all the .org files in git for example, but that would require me to remember to pull and push to keep the repo updated. Could work with a few scripts to automatically handle the files, as I don't have that many.

I could try using dropbox for this as well. I'd assume dropbox syncs the files often enough to not cause problems.

Does org-mode offer any functionality to help with synchronizing the files across multiple locations?

10

I use git-annex assistant to sync my org files across my computers and even my phone (a jolla so the linux binary works out of the box but there is also an android version).

It works like dropbox in that whenever you save a file it will try to sync it but it is decentralized and free (as in free speech and free beer).

The setup is straightforward if you know git but you need some time to familiarize yourself with all the options.

You can find more at http://git-annex.branchable.com

  • Please correct me if I am wrong, but git-annex assistant is a horrible choice. It doesn't check for changes within text files. It also sets the files to 'read-only' every time they sync. – JasoonS Feb 20 '17 at 14:15
7

Org files are just plain text files, so any technique that is able to synchronise plain text files will work fine with org files.

My favourite synchronisation tool is Unison. With the right configuration file, I type

unison org

and Unison will compare files in my ~/org/ directories on both my machines, let me interactively review its actions, then copy the files that need to be copied and invoke an external merge tool for the files that need merging.

  • Config file details? My attempts to merge in emacs keep failing – ijoseph Dec 16 '18 at 0:01
4

Org mode does not provide any syncing functionality itself. You would have to rely on a separate application like Dropbox to sync your files. Dropbox syncs not just often, but immediately when files change, so unless you change a file and immediately shut off your computer, you will keep your files in sync.

4

I personally have this problem and have been using copy instead of Dropbox to have my files in sync. (I don't use Dropbox because of privacy issues). Just like Dropbox, Copy offers clients for all the major platforms.

Sometimes I forget to save my org buffers, so I have hacked the following functions to save all org files whenever I save some file. Not a great solution, but it serves my purpose.

(add-hook 'after-save-hook 'org-save-all-org-buffers)

Also, if you hold sensitive data in your org files, I recommend you to take a look at this page. I use org-crypt which is amazing.

2

I use Git to synchronize my org-mode files. I have a Bash script that I leave running in the background, which automatically commits the file every minute (by default), and then pushes or pulls as needed.

The pseudo-code version:

  1. Commit local changes and update remotes.
  2. Find local commit with git rev-parse @.
  3. Find remote commit with git rev-parse @{u}.
  4. Find base with git merge-base @ @{u}
  5. If local commit equals remote commit, then we are done; everything is up-to-date.
  6. If local commit equals base, then remote has extra commits, so do git pull.
  7. If remote commit equals base, then local has extra commits, so do git push.
  8. Otherwise, both local and remote has extra commits. My script tries to resolve this automatically (with git pull), but if it can't, will send a bell and exit for the user to fix manually.

Those 8 steps run in a loop, not stopping until I exit manually with C-c, or there is an error.

I use this script on Windows using Cygwin.

2

I use Dropbox to synchronize my main .org files instead of rsync, git or the like because using Dropbox you can also use MobileOrg to see your .org files from your smartphone.

For me this is very easy and it does an awesome job.

2

As others have said, Org mode doesn't do anything about this itself (nor should it). So it's basically a matter of finding your preferred file sync solution.

I use Dropbox. It functions without effort on my three platforms (macOS, desktop Linux, Android). Also, the mobile Org client I use, Orgzly, supports it out of the box.

1

I'm currently using btsync, but there are several open (and more cumbersome) alternatives around. It basically watches the directory and syncs it to all other running devices as soon as they get online. A dropbox without the cloud so to speak. Since it uses distributed hash tables and the torrent protocol firewalls aren't an issue either, and there are mobile clients, too. And it transfers everything encrypted.

0

Dropbox (or any other cloud storage I guess) is the way to go. In addition, this is really handy to synchronize the Emacs setup in ~/.emacs.d (use mklink on Windows).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.