Sort out a conflicted copy
See what happens when a file or a note changes in two places at once, and keep the version you want.
A file can change in two places at once, such as in two directories that follow one folder, or in your editor and from an agent. What Marfa keeps depends on the kind of file.
A file such as a photo or a PDF
The later write wins, and every directory gets it at its next sync. The earlier version stays in the item's history. To get it back, list the item's versions, copy the earlier version's blob_ref, and download its bytes:
marfa items versions 01a1f470-1f08-7006-8897-e8578ff0a615 --json
marfa blobs download sha256:728b6feebe65d1addec0e13fbda13e177b3ca2b16a928da1c359259e8dfd6369 --output beach-earlier.pngA note
Most edits merge: a tag added in one place and a new body in the other both reach the note. When both change the note's body, even on different lines, or both change its notes property, the edit that reaches your instance first keeps the note, and the other becomes a conflicted copy beside it, in every directory that follows the folder:
---
type: core.note
tags:
- conflicted-copy
- home
title: Packing list
derived-from:
- "[[01a1f470-1ef0-742f-bbfd-9778bef2e18f]]"
marfa_id: 928a8aeb-c27b-71bb-8a07-e67863a57ec3
marfa_version: 1
---
Passport, sun hat, sandals.The copy holds the second edit word for word, is tagged conflicted-copy, and names the original on its derived-from line. marfa items list --tag conflicted-copy finds every copy.
To keep the version you want:
- Open both files,
Packing list.mdandPacking list (2).md. - Copy what you want from the copy into the original, and save it.
- Delete the copy's file. It moves to the bin, where you can restore it.
Edit the original, not the copy, so the note's links, tags and history stay with it. An agent can do the same: ask it to find notes tagged conflicted-copy and merge each pair as you say.
A save made as Marfa writes
Marfa never overwrites or removes a save it didn't read. If your editor saves a file just as Marfa writes a change from your instance into it, or removes it, Marfa puts your save back at the path, and the next sync sends it. If another file took the path meanwhile, Marfa keeps your save beside it under the next free numbered name, such as Packing list (2).md, and marfa folders status flags it kept.
To make conflicts rare, keep a watch running on every computer, so each edit reaches the others before the next one starts.