Git for file syncing

Has any thought been given to using git for file syncing ? It’s also possible to remove revisions from a file, so it could keep X amount of revisions for syncing too.

There appears to be a JS lib that can help https://github.com/isomorphic-git/isomorphic-git

4 Likes

This is an interesting idea - especially now that GitHub supports free private repositories. It could even be cool if you had the option of having either all notebooks and notes in a single repository or separation of notebooks into unique GiutHub repos. That way, it would leave the runway open for some future way of making a notebook / repo public and therefore act as a kind of wiki or documentation keying off one main README.md file that could have the table of contents for the notebook. People could read the public notebook online while you use Joplin to write and update it. I do not like the idea of featuring so many options that it becomes difficult for the development team to maintain, but I do kind of like this GitHub concept. Thanks for putting it out there; I hope it’s something the dev team might at least consider (for benefits and drawbacks).

4 Likes

I didn’t even consider github as a free sync source. That’s a great idea too. I was specifically thinking of doing the file system sync which is my usecase. Also in general, I imagine there’s tricky code involved with doing revisions in general etc that git could handle.

Gitlab also have free accounts. And unlike dropbox and other sync methods, these aren’t limited by some size that I’m aware of

1 Like

Exactly. That’s one thing I do not like about DropBox. Right now, I use DropBox for two critical applications I use daily (Scrivener for hard-core book writing and Joplin for daily notes). So far, I’ve not eaten up all my free space, but I know it’s a comin’… and that sucks. If I could offload some onto something that, as of yet has no stated limit (like GitHub), that could be cool!

Here’s another thought. What if the TO DO items in a notebook could actually create issues in the GitHub repo also? Maybe it’s a dumb idea, I don’t know, but I’m just thinking that it suddenly makes Joplin a kind of cool client for GitHub repos that are focused on documentation and issue tracking.

Using a git repo has been suggested many times but so far noone tried to implement this. I expect bundling a git client with desktop and especially mobile would not be an easy task, assuming it can be done with React Native.

Not sure about performance either. The unit of operation for Joplin is a file read or write, and the unit for git is the commit. So does that mean there should be millions of commits, one per file? Or if not, then the way Joplin sync works would need to be changed completely.

Then there’s the need to manage ssh keys, passwords, maybe 2FA, etc. I also wonder what will happen when someone rebase or rollback commits, since Joplin is not designed to handle this either.

1 Like

I don’t even want to know how users will handle a simple git conflict (due to 2 clients using the same repo). Then there are all the points that Laurent brought up, which btw. were mentioned ad infinitum in other posts and on github.

Please note: Joplin cannot resolve conflicts on its own - no SW can.

2 Likes

usually people don't tamper with the files in the sync directory right? It's similar to tampering with the sqlite databse, you do so at your own peril and it lies outside of the scope of regular use.

One approach I thought about is using a branch per note, having a metadata.json and a file for the note. For example.

The reason I thought it was easier is synchronizing the pushing/pulling. There would have to be some ruleset for handling conflicts, maybe git merge would do, but joplin etc already handles conflicts in some way too.

For me, I was only thinking of the scope of using dropbox without encryption and not much further. I know there are some encryption plugins for git.

Was just throwing this out there to see if it would help

1 Like

The unit of operation for Joplin is a file read or write, and the unit for git is the commit.

I think it's more relevant to say the unit of operation for Joplin is a "sync" and for git is the commit.

Currently Joplin syncs local files to the remote backup, the git feature would simply just commit changes and push to remote on Joplin sync.

3 Likes