I generally add workspace.json to the .gitignore, since any time you change the UI state e.g. open a drawer or change the size of a side bar, this file will be updated. However, ignoring it also means that any time you clone the vault somewhere else, you’ll have to setup your UI again.

Using update-index --skip-worktree should be able to fix this:

git add .obsidian/workspace.json -f # -f since the file is ignored
git commit -m "workspace.json Snapshot"
git update-index --skip-worktree content/.obsidian/workspace.json

That last line basically tells git to ignore all future changes, despite it being added to the repository. Basically snapshotting it.

To undo this we can then run:

git update-index --no-skip-worktree .obsidian/workspace.json

Then you can go back to committing the file. Once you’re happy you can once again freeze the file with —skip-worktree.

Note

If the file gets changed on remote and you try to pull, you will need to unfreeze, discard/commit/stash changes, pull, refreeze. (that being said, I use pull with rebase, if you use merge, this might not be an issue)