Resolve merge conflicts in a synced API collection
Two people change the same collection: one in Requestarium, one in the repository. With plain files in Git, that is a text merge of YAML and a lot of squinting. Requestarium merges a synced collection the way you'd want it merged: by request and by field, and it only asks you about the changes that really collide.
What merges on its own
Requestarium compares three versions: what the collection and the repository both had at the last sync, what the collection has now, and what the repository has now. Then:
| Change | Result |
|---|---|
| Anna changed the URL in the app; Bob changed a header in the repository | Both kept |
| Anna edited the first lines of a script; Bob edited the last ones | Both kept, line by line |
| Anna added a request; Bob added another | Both added |
Anna and Bob both set the timeout, to 30 and 60 | Conflict |
| Anna deleted a request Bob changed | Conflict |
Bodies, scripts and docs are merged line by line, so two people editing different parts of a long test script don't collide.
Where conflicts show up
- When the Git sync dialog compares the collection with the repository: on opening and after a webhook.
- When an automatic pull (after a webhook or a scheduled check) meets one. It changes nothing; the sync button shows a dot.
- After switching to another branch with edits that weren't pushed.
- In
requestarium sync pullandsync push, which fail and change nothing.
Settle them in the app
The dialog groups conflicts by object, for example request Refunds with its name and url. For each field, pick:
| Choice | Result |
|---|---|
| Mine | Keep the collection's value; it goes to the repository on the next push |
| Repository | Take the repository's value; it arrives with the pull |
| Merged value | Type a value that replaces both. Text fields take text; numbers, switches and lists take JSON such as 30, true or ["a", "b"] |
For an object deleted on one side and changed on the other, the choice is keep it deleted or keep the changed version.
Shortcuts help with big merges: Keep mine and Take the repository's next to an object, Keep all mine and Take all from the repository for everything. "2 of 5 chosen" shows what's left.
Apply choices compares again with your choices and shows what a pull and a push will do, without changing anything yet. Then Push pulls first and commits the merged result, so one push settles both sides.
Settle them in the CLI
In a terminal, --resolve asks about each conflict in turn:
requestarium sync pull "Users API" --resolveIn a script, write the choices to a file. sync status --json --verbose prints each conflict's key and both values, and --resolve-file takes a JSON map of key to "ours", "theirs" or { "value": … }:
requestarium sync status "Users API" --json --verbose > conflicts.json
requestarium sync push "Users API" --resolve-file choices.json --strategy theirs--strategy ours|theirs settles every conflict still open in one direction. In a nightly job that should always trust the repository, sync pull --all --strategy theirs is the usual choice.
What is recorded
The sync history notes that conflicts were met, how many, and against which commit. The result of your choices is in the commit the push makes, and in the collection's own change history.