Back to docs
guides

Git Sync Setup

Syncing Notes with Git

Strayfiles can automatically commit your changes to Git. This works great for notes that live in Git repositories.

Looking for GitHub Sync? This page covers the free Git auto-commit feature for notes in existing repos. For the Pro add-on that backs up all your notes to a dedicated GitHub repository with dual-sync support, see GitHub Sync (Pro).

Basic Setup

Enable auto-commit in your strayfiles.toml:

[sync]
git_auto_commit = true
commit_message = "strayfiles: auto-save"
git_remote = "origin"

How It Works

  1. You edit a note in Strayfiles
  2. You save (or auto-save triggers)
  3. Strayfiles commits the change
  4. Commit pushed to your remote

Configuration Options

SettingDefaultDescription
git_auto_commitfalseEnable automatic commits
commit_message"strayfiles: auto-save"Commit message template
git_remote"origin"Remote to push to

Commit Messages

The default message is "strayfiles: auto-save". Customize it:

[sync]
commit_message = "docs: update via strayfiles"

Or use conventional commits:

[sync]
commit_message = "chore(notes): auto-save"

When to Use Git Sync

Good for:

  • Notes in code repositories
  • Documentation alongside code
  • CLAUDE.md and similar context files
  • Anything already version-controlled

Not ideal for:

  • Personal notes (use folder sync or Pro instead)
  • Rapid editing (many small commits)
  • Large binary attachments

Notes in Repos vs. Standalone

Notes in code repos:

my-project/
├── src/
├── CLAUDE.md        ← Git synced with project
├── docs/
│   └── setup.md     ← Git synced with project
└── .git/

Standalone notes repo:

~/notes/
├── ideas/
├── work/
├── personal/
├── strayfiles.toml
└── .git/            ← Dedicated notes repo

Both work with Git sync.

Setting Up a Notes Repo

Create a dedicated Git repo for notes:

mkdir ~/notes
cd ~/notes
git init
git remote add origin git@github.com:you/notes.git

Add Strayfiles config:

# ~/notes/strayfiles.toml
version = 1

[settings]
roots = ["./"]
exclude = [".git/**"]

[sync]
git_auto_commit = true

Working with Branches

Git sync commits to your current branch. If you use feature branches:

  1. Strayfiles commits to current branch
  2. Switch branches in terminal as needed
  3. Commits follow normal Git workflow

Conflicts with Git Sync

If you edit on multiple devices before pushing:

  1. Git handles the merge on pull
  2. Resolve conflicts using Git tools
  3. Strayfiles re-indexes after resolution

For complex merge needs, use Git directly rather than Strayfiles’ conflict resolution.

Disabling for Specific Notes

Git sync applies to all notes in Git repos. To exclude specific files:

  • Add to .gitignore (stops Git tracking entirely)
  • Or use sync: false in frontmatter (keeps file local-only for Stray Cloud and GitHub Sync Pro)
---
strayfiles:
  enabled: true
  sync: false
---

The sync: false option keeps your note tracked by Strayfiles but prevents it from syncing to cloud backends.

Manual Git Workflow

Prefer manual control? Disable auto-commit:

[sync]
git_auto_commit = false

Then commit and push manually when ready.

Tips

Review before push: Disable auto-commit, review changes with git diff, then commit manually.

Squash auto-commits: If you accumulate many small commits, squash them before pushing.

Use meaningful messages: For important changes, commit manually with descriptive messages instead of relying on auto-commit.

Multiple remotes: Git sync pushes to one remote. To push to multiple, use Git hooks or manual pushing.

Troubleshooting

“Not a git repository”: The note isn’t in a Git repo. Initialize one or move the note.

“Remote not found”: Configure the remote: git remote add origin <url>

“Push rejected”: Pull first to get remote changes: git pull

“Uncommitted changes”: Strayfiles only commits its own changes. Commit or stash other changes first.

Git Sync vs GitHub Sync (Pro)

FeatureGit Sync (Free)GitHub Sync (Pro)
CostFreePro subscription
Use caseNotes in existing reposDedicated notes backup
AuthenticationYour Git credentialsSecure Device Flow OAuth
Dual-syncNoYes, with Stray Cloud
Conflict resolutionUse Git toolsBuilt-in 3-way merge
iOS visibilityNoYes (read-only status)
tree.json manifestNoYes

Choose Git Sync when your notes live in code repositories and you want them committed alongside your code.

Choose GitHub Sync (Pro) when you want a dedicated notes repository with full Strayfiles integration and dual-sync support.