Refactor workspace file to be git friendly

Use case or problem

When I try to sync a workspace via git across different accounts, I keep getting conflicts with the .obsidian/workspace file as it maintains the state of the current workspace.

Proposed solution

I propose that the developers refactor out the bits that change state relative to the open instance into a new config file, one that can be easily be added to a .gitignore file to avoid this issue.

Current workaround (optional)

You could add the whole of the workspace file to the .gitignore, but there is value in syncing these

Note: This use case is mostly an issue if you have two of the same workspace open at the same time in different accounts.

For anybody else who wants a workaround, you’ll need to create a different .obsidian directly for each device and manually update them when you change a part of the workspace environment. for instance. I’ve created an .obsidian.mac and an .obsidian.mobile.ios . But you also need to append the username for each account if sharing on a device.

Sorry for my lateness, this was a high google search result and so this might help someone else doing googles for this.

 

Clarification of supertodda’s current workaround

create a .gitignore file in your repo (assuming you initialized your repo on the top level of your vault), and then add the following to this file:

.obsidian/workspace*

I added the wildcard * for added security because obsidian creates a whole bunch of backups while you’re writing your notes.

If you’re having trouble merging currently, then I would delete all instances of the .obsidian/workspace file in all your branches to make it super easy, then ensure your .gitignore is set up like shown above, commit the branches, and start merging without this headache again.