# typora-git-sync **Repository Path**: yufire/typora-git-sync ## Basic Information - **Project Name**: typora-git-sync - **Description**: 一个可以将Typora支持文件同步的工具! - **Primary Language**: Swift - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2026-05-11 - **Last Updated**: 2026-05-11 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # TyporaGitSync > Not affiliated with Typora. > > 中文文档请查看 [README_CN.md](./README_CN.md)。 [![macOS](https://img.shields.io/badge/macOS-15%2B-111111?logo=apple&logoColor=white)](https://www.apple.com/macos/) [![Swift](https://img.shields.io/badge/Swift-6.0-F05138?logo=swift&logoColor=white)](https://www.swift.org/) [![UI](https://img.shields.io/badge/UI-SwiftUI%20%2B%20AppKit-0A84FF)](#) [![Storage](https://img.shields.io/badge/Storage-SQLite-003B57?logo=sqlite&logoColor=white)](#) [![Mode](https://img.shields.io/badge/App-Menu%20Bar%20%2B%20Floating%20Orb-34C759)](#) [![Docs](https://img.shields.io/badge/Docs-English%20%7C%20%E4%B8%AD%E6%96%87-8E8E93)](./README_CN.md) TyporaGitSync is a native macOS companion app for Git-backed Typora workspaces. It helps you keep Markdown directories in sync with a remote Git repository by combining: - a menu bar workflow - a floating sync orb - automatic Git polling and sync - Typora-aware behavior for opening and syncing workspace folders TyporaGitSync is designed for people who write in Typora but want a lightweight Git sync experience without switching to a full note platform. ## Highlights - Native macOS app built with SwiftUI and AppKit - Menu bar first experience, no Dock icon - Floating orb for at-a-glance sync state - Manage multiple local Git workspace directories - Auto-detect local file changes through Git status polling - Auto sync on interval - Optional sync when Typora exits - Open Typora directly from a managed workspace directory - Basic hosting provider recognition for GitHub, Gitee, GitLab, and Bitbucket - Local sync history persisted in SQLite ## Screens at a Glance - `Sync`: workspace status, managed repositories, quick actions, new workspace onboarding - `History`: recent sync records - `Settings`: sync interval, Typora monitoring, floating orb, notifications, Git path ## How It Works TyporaGitSync does not rely on real-time filesystem watchers in the current version. Instead, it periodically checks each managed Git repository with `git status` and performs sync operations when needed. The sync engine is intentionally simple: 1. `git fetch` 2. detect local changes 3. `git add -A` 4. auto commit when needed 5. `git pull` 6. `git push` If a repository enters a conflict state, TyporaGitSync pauses automatic sync for that workspace until the conflict is resolved. ## Typical Workflow The recommended flow is: 1. Create a remote repository on GitHub, Gitee, GitLab, or another Git hosting provider. 2. Clone that repository to your Mac. 3. Open the cloned directory in Typora and start writing. 4. Launch TyporaGitSync. 5. Click `托管远程 Git 仓库`. 6. Select the local cloned directory. 7. Confirm the workspace name and remote name. 8. Click `添加`. Once the directory is managed, TyporaGitSync will: - detect uncommitted changes - show pending sync state in the floating orb - sync on the configured interval - optionally sync again when Typora exits ## Usage Guide ### 1. Prepare a Git-backed Typora workspace Create a repository first, then clone it locally: ```bash git clone git@github.com:yourname/your-notes.git cd your-notes ``` You can also use Gitee: ```bash git clone git@gitee.com:yourname/your-notes.git cd your-notes ``` After that, open the directory in Typora and start editing Markdown files. ### 2. Add the workspace to TyporaGitSync In the app: - open the menu bar panel - go to the `同步` tab - click `选择` - select a local directory that is already a valid Git repository - click `添加` If the selected directory is not a valid Git repository, the app will immediately warn you and reject the selection. ### 3. Open Typora from a managed workspace Each managed repository provides: - `同步` - `在此目录打开 Typora` - `在 Finder 中打开` `在此目录打开 Typora` tries to open Typora for that workspace directory. If Typora prefers a Markdown file target, the app falls back to a suitable file inside the directory. ### 4. Watch sync status TyporaGitSync exposes status in two places: - the menu bar icon - the floating orb Status colors: - green: healthy - yellow: local changes detected - blue: syncing in progress - red: conflict or sync failure - gray: no managed workspace or all workspaces disabled ### 5. Configure sync behavior In `设置`, you can adjust: - default sync interval - Typora process monitoring - sync on Typora exit - floating orb visibility - system notifications - Git executable path ## Repository Requirements Each managed directory must satisfy all of the following: - it must be a valid Git repository - it must be the repository root, not a subdirectory - it must already have a configured remote - its current branch should already have an upstream branch configured If these conditions are not met, TyporaGitSync will reject the workspace. ## Conflict Handling If a workspace enters a Git conflict state, automatic sync is paused for that workspace. Examples include: - merge in progress - rebase in progress - cherry-pick in progress - `git pull` conflict After resolving the conflict manually, you can resume sync from the app. ## Sync History TyporaGitSync stores local sync records in SQLite. Current retention behavior: - the UI shows the latest 4 records - the local database keeps the latest 10 records - Git commit history is not modified or truncated ## Requirements - macOS 15.0 or later - Typora installed on the local machine - Git installed and available on the system - an accessible remote repository ## Development ### Build with Xcode Open: - `TyporaGitSync.xcodeproj` Then run: - scheme: `TyporaGitSync` - destination: `My Mac` ### Build with Swift Package Manager ```bash swift build ``` ### Run tests ```bash swift test ``` ## Project Structure ```text Sources/TyporaGitSync/ ├── App/ # app lifecycle, menu bar, floating orb, notifications ├── Application/ # coordinator, sync service, Typora monitoring ├── Domain/ # models and state ├── Infrastructure/ # Git, SQLite, repositories, app paths ├── UI/ # screens, components, styles └── Resources/ # icons and app assets ``` ## Roadmap Ideas - richer onboarding for first-time users - improved visual polish for the menu bar panel - better provider-specific branding - configurable sync strategies - deeper Typora workspace heuristics ## License MIT ## Chinese Documentation For a Chinese guide, see [README_CN.md](./README_CN.md).