Obsidian × Git

context

Obsidianで管理しているドキュメントに対して気付かぬうちに誤ペースト(cmd + a > cmd + v)をしてしまい、そのまま上書きされた結果、大事なドキュメントがゴミと化す事件が何度かあった。誤ペーストを防ぐことは出来なさそうので、バージョン管理を導入して自分の尻拭いをすることにした。

specification

  • リモートリポジトリは不採用
    • マルチデバイス間の同期はicloud上にvaultを配置することで一旦実現しているので
  • ObsidianプラグインのObsidian Git3を導入
    • Split automatic commit and pushは有効にしてpush系はfalse
    • Auto commit interval60
    • あとは基本初期値のまま
  • .gitignoreには公式推奨1のものをそのまま追加
# to exclude Obsidian's settings (including plugin and hotkey configurations)
.obsidian/

# to only exclude plugin configuration. Might be useful to prevent some plugin from exposing sensitive data
.obsidian/plugins

# OR only to exclude workspace cache
.obsidian/workspace.json

# to exclude workspace cache specific to mobile devices
.obsidian/workspace-mobile.json

# Add below lines to exclude OS settings and caches
.trash/
.DS_Store

note

  • これで安心して誤ペーストできるようになった
  • シェルで./_debris build --sass --live --optimize-images回しながらLazygit2でObsidianのbackup状況を眺めるのが楽しい

  1. Tips-and-Tricks - Git Documentation - Obsidian Publish
  2. GitHub - jesseduffield/lazygit: simple terminal UI for git commands
  3. GitHub - Vinzent03/obsidian-git: Integrate Git version control with automatic commit-and-sync and other advanced features in Obsidian.md
related* created updated category
latest* created updated category