Skip to content

Git and merging ​

Comparing two models and migration SQL, the Git history panel, model-level merging (three-way merge) and the Git merge driver.

To follow along from preparing the repository, see Work together and merge with Git in Quick start. None of these features ever write anything to your Git repository.

Preparing the repository ​

Sorted saving, which keeps Git diffs small (on by default), is described in File › Sorted saving. Add one line to the repository's .gitattributes to keep line endings consistent:

*.erm text eol=lf merge=relio

Compare and merge menu ​

Menu › ItemWhat it does
File › Compare and merge › Compare two files…Pick file A (before) and B (after) and compare them.
File › Compare and merge › Compare with saved fileCompares the current document's unsaved changes with the file on disk.
File › Compare and merge › Compare with another file…Compares a file you pick (A) with the open document (B).
File › Compare and merge › Resolve Git merge conflict…Resolves a file in a Git merge conflict at the model level.
File › Compare and merge › Merge with another branch version…Merges with the same file on another branch.
File › Git historyOpens the Git history panel for this file. You can also click the branch name in the status bar.

Comparison view ​

A comparison opens in a read-only tab. Tables, columns and relationships are paired by name and internal number, and renames are guessed from similarity.

  • Change list — Shows Added · Removed · Changed · Renamed · Moved · Property change. Expand an item to see the Before · After value of each field. Items paired by guessing are marked "(guessed)".
  • Group: By table / By type — Groups the change list per table or per kind of change (Ctrl+Shift+G). Markdown export and copy follow this grouping.
  • Filters — Choose which changes to show (Structure · Documentation · Layout · Settings), and filter with Search names and Guesses only (only renames guessed from similarity).
  • Side shown on the canvas — Show A · Show B. Turn on Dim the rest to draw unchanged objects dimmed.
  • Swap A⇄B reverses the direction, and Compare again reloads both sides.
  • Open A · Open B — Open the original file to edit it.
  • Export ▾ — Markdown… · CSV… · JSON… (everything, regardless of filters) · Copy (Markdown) · Generate migration SQL…. Markdown and CSV follow the current filters.
  • If the two models are identical, it says "The two models are the same".

Change marks on the canvas ​

  • Changed nodes are marked with a border color and a circle at the top left (+ added · − removed · ~ changed); changed columns with a background color on their line and a symbol at the end.
  • In Show B, removed tables, views, notes and images appear at their old position in A as gray dashed boxes (− name, struck through), and removed columns as dashed lines under their table (− column name, struck through).
  • In Show A it is the other way round: what was added in B appears as dashed boxes and lines (+ name).
  • Click a dashed box or line to select that item in the change list.

Change list keys ​

KeyWhat it does
↑ ↓Move between items
→ / ←Expand / collapse the selected item
EnterShows the selected item on the canvas.
Ctrl+CCopies the selected change as Markdown
Comparison view — the change list grouped by table, with side B on the canvas
Comparison view — the change list grouped by table, with side B on the canvas

Generating migration SQL ​

Export ▾ › Generate migration SQL… in the comparison view generates SQL (ALTER and so on) that changes a database with A's structure into B's structure. PostgreSQL · MySQL · MariaDB · SQL Server · Oracle are supported. Relio only generates this SQL; it never runs it.

FieldDescription
Target database · Target product · Target versionThe database to generate the SQL for.
Swap directionSwaps A and B to generate SQL in the opposite direction.
n renames guessedHow to write renames that are not certain: Keep as comments (default) · Rename · Drop and add
Include database commentsAlso generates SQL for comment changes.
Wrap in one transactionWraps the whole script in a single transaction (on databases that support it).
File nameDefault name or Flyway name
  • The SQL tab shows the script and the Warnings tab shows risky changes. Risky changes are flagged as Data loss (data disappears) · Data-dependent (may fail depending on the data) · Breaking change (outside programs may break).
  • With "Keep as comments", uncertain spots are written as comments and Relio tells you how many items need review — until you decide, the result differs from B.
  • Changes that cannot be generated are listed in a "Manual step required" list at the end of the script.
  • Export with Save… · Copy. On the command line, use relio diff --format sql.

Warning

Always read migration SQL before running it, deal with the "Manual step required" list, and then run it yourself in your database tool. Back up production databases first.

Git history ​

File › Git history (or the branch name in the status bar) opens a panel on the right.

  • At the top, choose the current branch or another branch or tag in Branch or tag to start the history from. Refresh reloads it.
  • Latest commit card — Shows a summary of the change from the previous version (Tables +1 · Columns +2 ~3). Click the card to compare with the previous version, or click a chip to open the comparison with that type expanded. Merge commits are compared with their first parent.
  • Buttons below the commit list:
    • Compare with previous version — A = the version just before, B = the selected version.
    • Compare with current version — A = the selected version, B = the open document. Double-clicking a row does the same.
    • Compare two versions — Hold Ctrl and select two rows (the older one is A).
    • Open this version — Opens that version in a read-only tab (Save as still works).
  • History follows file renames. For files outside a repository, unsaved documents and read-only tabs, Relio tells you there is no history.

Merging ​

When the same .erm was changed in two places, Relio merges by model object (tables, columns, relationships and their fields), not by line. What each side added merges without conflicts; you only choose where the same field was changed differently. The result is always a valid .erm.

Ways to open it ​

  • When the file changed outside Relio — Merge… in the notice shown when you return to the window, or in the check just before saving.
  • Git merge conflict — File › Compare and merge › Resolve Git merge conflict…. If you try to open a file that still has conflict markers (<<<<<<<), you can resolve it right from the notice. When you open a file in a conflicted state, a "Git merge conflict remains" bar with a Resolve button appears at the top.
  • With another branch — Choose the version to merge in File › Compare and merge › Merge with another branch version…. The repository is not changed; only the open document is.
  • A file damaged by a line-based merge — Redo the merge at the model level on the "This file may have been damaged by a line-based merge" bar.

Merge tab ​

  • The list is split into Conflicts · To review · Automatic (Automatic — current only · Automatic — incoming only · Automatic — same on both). The top shows n automatic · n conflicts (n left) · n to review.
  • Expand an item to see the Base · Current · Incoming value of each field, and choose per row.
  • Side shown on the canvas — Result · Current · Incoming. Conflicting objects are highlighted, and Dim the rest dims unrelated objects.
  • Filter with Search names and Conflicts only, and decide everything at once with Current for all remaining conflicts · Incoming for all remaining conflicts. Copy list copies the item list as Markdown.
  • If the document or the file on disk changes again in the meantime, Relio tells you and suggests Merge again.
KeyWhat it does
↑ ↓Move between items
1 · 2 · 3Current value · incoming value · both
F8 / Shift+F8Next · previous conflict
Ctrl+EnterApply
Merge tab — a conflict expanded to choose between the base, current and incoming values
Merge tab — a conflict expanded to choose between the base, current and incoming values

Applying ​

When no conflicts remain, Apply puts the result into the document. The whole merge is undone with a single undo (Ctrl+Z). Save to write it to the file. Cancel closes the tab without merging (the document is unchanged).

After you resolve a Git conflict and save, the status bar says "Conflict resolved — run git add … to tell Git". Run git add yourself.

Git merge driver ​

Register the command-line relio merge as a Git merge driver, and git merge and git rebase merge .erm files at the model level automatically. When conflicts remain, Git leaves the file conflicted; open it in Relio and finish with Resolve Git merge conflict…. How to register and check the driver is in Command line › Git merge driver.

Relio is a separate tool, not affiliated with ERMaster.