Ok here are a few tips after following OP’s suggestions. I use:
- macOS on my laptop
- obsidian-git plugin (desktop only as of August 2, 2021).
- Obsidian mobile on iOS
- Working Copy (App Store download on iOS with $20 lifetime upgrade which allows push capabilities
Depending on your workspace needs, and assuming you have 1 mobile, and 1 desktop device, and you use it yourself only. Due to the
.obsidian/workspace file getting changes always, I suggest one of the following options:
1. You want a separate workspace for mobile and desktop versions:
As OP said, create a separate
.obsidian.mobile folder for mobile. Once synced, duplicate your original
.obsidian folder and rename it
.obsidian.mobile. This way, at least from the get-go, you will have the same plugins, settings, themes, etc, and you can customize from there, as opposed to redownloading everything and setting everything up from default Obsidian.
2. You want the same workspace
Just use the
.obsidian folder for both.
But for both options:
If you don’t already, add a
.gitignore file in your root directory where you initiated your git project. If you’re like me, you just commit ALL changes, push them, and who cares about the message.
Note for people who don’t know why you probably don’t care about workspace changes: A workspace is just a file that has info on where your panels are, a bit of history on last files opened, what file you’re on, etc. This file gets updated with nearly every mouse click and keyboard stroke. This means if you don’t add this file to gitignore, you git repo will have potentially commits every few minutes you use your device.
The first time you get everything synced up, just
git add .. This adds all files to git to be tracked. Once you got everything working, able to commit/push/pull/merge on both of your devices, you need to remove
workspace from git.
git rm --cached .obsidian.mobile/workspace && git rm --cached .obsidian/workspace or
git rm --cached .obsidian/workspace from terminal.
- Now open that
.gitignore file you created earlier and add one line that looks like
.obsidian*/workspace. This works whether you are tracking changes within one workspace, or two.
Now you don’t need to worry about workspace conflicts between devices, or syncing when all that has changed is workspace data.
Note Even if you keep two distinctly separate workspace files, I still think you should
.gitignore them. This is because yes, you won’t have a single file being updated from two different devices, but your devices will both be downloading updates when there really is nothing important to update. For example, if you are having periodic pushes from your laptop using
obsidian-git, and all that is happening is you’re reviewing your notes, well the workspace file is being edited. And now when you go to your phone, you need to fetch/pull changes.
Oh, and if you ever do want to start syncing
workspace changes for whatever reason, you can always comment out the one liner in the
.gitignore file by editing it to look like this:
# .obsidian*/workspace. Then in terminal
git add . to add those workspace files. And when you want to undo it, just do the steps I showed above having to do with
git rm --cached ...