obsidian-git README

项目的 README,来自 github.com/Vinzent03/obsidian-git。合并为一个 markdown 文件:README.md。

Git Plugin for Obsidian

A powerful community plugin for Obsidian.md that brings Git integration right into your vault. Automatically commit, pull, push, and see your changes — all within Obsidian.

Documentation

All setup instructions (including mobile), common issues, tips, and advanced configuration can be found in the full documentation.

Mobile users: The plugin is highly unstable. Please check the dedicated Mobile section below.

Key Features

For detailed file history, consider pairing this plugin with the Version History Diff plugin.

UI Previews

Source Control View

Manage your file changes directly inside Obsidian, including staging and unstaging individual files and committing them. The main Commit action commits staged changes when present. The actions menu provides explicit staged-only and all-changes alternatives, plus amending the previous commit on desktop.

Source Control View

History View

Show the commit history of your repository. The commit message, author, date, and changed files can be shown. Author and date are disabled by default as shown in the screenshot, but can be enabled in the settings.

History View

Diff View

Compare versions side by side with highlighted changes. Review, stage, or reset individual hunks without leaving the diff view. Open it from the source control view or via the Open diff view command.

Diff View

Signs in the Editor

View line-by-line changes directly in Live Preview with added, modified, and deleted line/hunk indicators. You can stage and reset changes right from the signs. There are also commands to navigate between hunks and stage/reset hunks under the cursor. Needs to be enabled in the plugin settings.

Editor signs with a hunk preview and stage/reset controls

Conflict Resolution

Resolve conflicting changes in Live Preview without leaving your note. Highlighted sections show your version and the incoming version, with buttons to keep ours, theirs, or both. The bar at the top lets you apply a choice to every conflict in the file. Source Control lists conflicted files and shows how many conflict blocks remain.

Conflict resolution in Live Preview, with local and incoming changes and the Source Control conflict list

When Git includes the common ancestor (for example, with merge.conflictStyle=diff3), you can also compare and keep the base version.

Conflict resolution with the common ancestor and Keep base controls

After reviewing the result, mark the file as resolved in Source Control, then commit to finish the merge. See the conflict resolution guide for the full workflow.

Available Commands

Not exhaustive - these are just some of the most common commands. For a full list, see the Command Palette in Obsidian.

Desktop Notes

Community scorecard

The Obsidian community scorecard reports automated code checks, including warnings about shell execution and direct filesystem access. On desktop, this plugin needs those capabilities to run your installed Git and work with repository metadata and Git configuration beyond Obsidian's vault API. These requirements contribute to the Review rating, so read it alongside the individual findings and in the context of native Git integration.

Authentication

Some Git services may require further setup for HTTPS/SSH authentication. Refer to the Authentication Guide

Obsidian on Linux

Mobile Support (Experimental)

The Git implementation on mobile is very unstable! I would not recommend using this plugin on mobile, but try other syncing services.

One such alternative is GitSync, which is available on both Android and iOS. It is not associated with this plugin, but it may be a better option for mobile users. A tutorial for setting it up can be found here.

The Git plugin works on mobile thanks to isomorphic-git, a JavaScript-based re-implementation of Git - but it comes with serious limitations and issues. It is not possible for an Obsidian plugin to use a native Git installation on Android or iOS.

Mobile Feature Limitations

Performance Caveats

[!caution] Depending on your device and available free RAM, Obsidian may

  • crash on clone/pull
  • create buffer overflow errors
  • run indefinitely.

It's caused by the underlying git implementation on mobile, which is not efficient. I don't know how to fix this. If that's the case for you, I have to admit this plugin won't work for you. So commenting on any issue or creating a new one won't help. I am sorry.

Tips for Mobile Use:

If you have a large repo/vault I recommend staging individual files and setting automatic commit globs to Include matches with an empty list, so automatic commits use only staged files.

Contact & Credits

Support

If you find this plugin useful and would like to support its development, you can support me on Ko-fi.

ko-fi

obsidian-git (Vinzent03/obsidian-git)

正在搜索数据库…

这是什么?Obsidian Git 是一个社区插件,可以把 Git 版本控制直接带进 Obsidian.md,让你在应用内提交、拉取和推送笔记库的更改。
这是独立应用,还是运行在 Obsidian 内部?它是运行在 Obsidian 应用内的插件,会为你现有的笔记库添加源代码管理视图、历史视图、差异视图,以及编辑器边栏标记。
我该如何开始在笔记库中使用它?从 Obsidian 的社区插件中安装,然后使用插件提供的命令初始化新仓库,或克隆已有的远程仓库;之后即可使用 Commit-and-sync 按计划自动提交、拉取和推送。
我需要单独安装 Git 吗,还是它自带?在桌面端,插件依赖已安装的原生 Git;在移动端,由于无法运行真正的 Git 程序,它会改用 isomorphic-git,这是一个 JS 重新实现的版本。
它在移动端表现好吗?移动端支持仍处于实验阶段,作者明确警告其非常不稳定:克隆或拉取时可能崩溃,不支持 SSH 认证,仓库大小受限,不支持变基,也不支持子模块。
在 Linux、macOS 和 Windows 上表现一致吗?桌面端都支持,但在 Linux 上不支持 Snap 版 Obsidian,由于沙盒限制也不建议使用 Flatpak;推荐改用包管理器安装或 AppImage。
一个笔记库里能同时管理多个 Git 仓库吗?可以,它提供可选的子模块支持,用于管理多个仓库,但这一功能仅限桌面端。
编辑笔记时能逐行查看更改吗?可以,它会在编辑器中直接显示新增、修改和删除的行及代码块标记,并提供暂存或重置单个代码块的命令。
能在 Obsidian 内直接查看文件在 GitHub 上的历史吗?可以,有命令可以直接在浏览器中打开当前文件或其历史记录的 GitHub 页面,但这仅在桌面端可用。
如果移动端同步太不稳定,有什么好的替代方案?作者推荐 GitSync,这是一款与本插件无关联的独立应用,同时支持 Android 和 iOS,可作为更可靠的移动端同步选择。
作者
Vinzent03
大小
6.5 MB
星标
12.3K
时长
6年
提交 · 90 天