A tool that automatically manages workspace/ symlinks for git worktrees.
When you create a worktree with git worktree add, wtsync automatically creates and repairs symlinks pointing to the main repository's workspace/ directory. It also supports persistent monitoring — FSEvents on macOS, inotify on Linux.
nimble build
cp bin/wtsync ~/.local/bin/Or:
nimble install_localRequirements: Nim >= 2.2.6, and either macOS (FSEvents) or Linux (inotify)
# Check/fix a single directory
wtsync check [path]
# Scan and fix all worktrees under ~/projects
wtsync fix [root]
# Show status of all worktrees (read-only)
wtsync status [root]
# Watch for new worktrees via FSEvents and auto-link
wtsync watch [root]Default root is ~/projects.
The same subcommands drive a launchd user agent on macOS and a systemd user unit on Linux.
wtsync daemon install # Install and start
wtsync daemon uninstall # Stop and remove
wtsync daemon restart # Restart (after binary update)
wtsync daemon status # Show running status
wtsync daemon log # Show logs| macOS | Linux | |
|---|---|---|
| Service file | ~/Library/LaunchAgents/com.wtsync.watch.plist |
~/.config/systemd/user/wtsync.service |
| Manager | launchctl |
systemctl --user |
| Logs | ~/.local/var/log/wtsync.log |
journalctl --user -u wtsync.service |
On Linux, a user unit stops when your last login session ends. To keep it running:
loginctl enable-linger "$USER"- Reads the
gitdir:entry from the worktree's.gitfile to resolve the main repository path - If the main repo has a
workspace/directory, creates a symlink in the worktree - In
watchmode, monitors creation events and links in real-time
| Platform | API | Notes |
|---|---|---|
| macOS | FSEvents | Recursive by nature — one stream covers the whole root |
| Linux | inotify | One watch per directory. Watches are seeded from the existing tree and added as new directories appear; a fresh directory is also scanned once so entries written before its watch was installed (such as the .git file git worktree add writes) are not missed |
| State | Meaning |
|---|---|
wsAlreadyLinked |
Correct symlink exists |
wsNeedsLink |
Symlink missing — fix will create it |
wsBrokenLink |
Symlink target is wrong — fix will recreate it |
wsRealDirExists |
A real directory exists (warning only) |
wsNoWorkspace |
Main repo has no workspace/ (skipped) |
MIT