Compare files

File → Compare Files… (or Compare Files… on the start page) opens a Compare tab to compare two files, or two folders. CSV and TSV files are compared as tables: rows are matched by a key (an ID column, or a few columns together), wherever they are in each file, so two exports of the same data in a different order compare cleanly. Other text files, logs included, are compared line by line, side by side. Logsift can also be git’s difftool and mergetool, with a three-way merge. To compare two logs by kinds of message, use Compare Logs by Message.

Two exports of the same orders compared by order_id: 6 added, 8 removed, 20 changed, changed prices and statuses as old → new

Starting a comparison

The Compare tab has a file browser on each side: Left (older) and Right (newer). They start at your home folder and the disks, and open at the folder you used last.

When the comparison opens, the browsers make room for the results. The files’ names are in one row right above the table (Left: stock.csv · 40 rows · 3 columns · 730 B; hover the details for the separator and encoding), with ⇄ to swap them and Choose Files at the end. Choose Files shows the two browsers in the table’s place, each under its file’s name; the button becomes ✕ Close Files, in the same spot, and takes you back to the table. Choosing other files makes Compare stand out in the accent colour: click it to compare them, keeping your keys and options. Double-clicking a file in a browser does the same.

Other ways in:

If a file can’t be compared (it isn’t CSV or TSV), the tab says why next to Compare.

The files may use different separators (commas in one, semicolons or tabs in the other), different encodings (UTF-8, UTF-16, Windows-1252), a byte order mark, Windows line ends and quoted fields over several lines.

Keys

A key is what makes a row the same row in both files: an order number, a user ID, or a few columns together (region + sku). Rows with the same key are compared value by value; the order of rows doesn’t matter.

Columns

Columns are matched by name, whatever their case or the spaces around them (Price and price *). A column only one file has is said once above the table (Column region only in the right file*), not as a change on every row.

Options

Option What it does
Trim spaces Spaces at the start or end of a value don’t count (on by default)
Ignore case Paid = paid, in keys too
Numbers as numbers, within Values that are both numbers are compared as numbers, so 1.50 = 1.5 (on by default). Within allows a difference: an absolute amount (0.01), or a % of the larger number
Empty = missing An empty value equals one that isn’t there, as in a row with fewer fields than the header (on by default)
Ignore row order Without a key: match equal rows wherever they are

After changing options, Compare in the options’ row stands out in the accent colour (Changed: press Compare): click it to compare again. Keys and columns left out compare again at once.

What it shows

Show (above the table) picks the rows, and says how many there are of each, with its symbol in its colour:

Show Colour Means
All differences   Everything but the same rows (the default)
≠ Changed amber The same key with different values
+ Added (only right) green A key only in the right file
− Removed (only left) red A key only in the left file
‼ Key repeats purple Key values on more than one row of a file: not paired, not compared. Only with a key
= Same gray The same key, the same values: unchanged rows
Everything   All rows

Changes per column, on the left, says how many rows changed in each column (price: 1,204 rows), most first. Click one to show only those rows; All columns shows them all again.

**Unified Side by Side** (above the table) picks the view; Logsift remembers it.

Next to the scroll bar, a strip of marks shows where the differences are among the rows shown: green added, red removed, amber changed, purple key repeats, with a box for the part on screen. Click or drag on it to go to the difference there. Switching views or Show keeps the selected row when it is still shown.

The table (unified) has a row per key: its Status (the symbol and the word, in its colour), Line (left → right) in each file, the key columns ((key) after their name) and the compared columns.

Export

Export ▾:

Limits

Text and logs

Files that aren’t CSV or TSV (logs, code, configs) are compared line by line, side by side, as a code review shows them. A CSV comparison’s Compare as Text shows the same files this way, and Compare as Table goes back.

Two runs of a job compared with times masked: a changed host, a line added, one gone, a step that failed; unchanged stretches folded

Merging

A three-way merge shows Yours on the left, the Result in the middle and Theirs on the right, on aligned rows. Changes made on one side only are taken already; a conflict, where both sides changed the same lines differently, is red until resolved.

A merge: a conflict on setting.20 in red, a change of theirs already taken in the result

Git

Help → Use Logsift with Git… shows the settings that make Logsift git’s difftool and mergetool, and Set Up Git writes them to your global git config (or Copy Commands to paste them yourself):

git config --global difftool.logsift.cmd '"/path/to/Logsift" --diff "$LOCAL" "$REMOTE"'
git config --global mergetool.logsift.cmd '"/path/to/Logsift" --merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"'
git config --global mergetool.logsift.trustExitCode true
git config --global diff.tool logsift
git config --global merge.tool logsift

Then git difftool shows each changed file in a Compare tab (git goes on to the next file when you close the tab), and git mergetool opens each conflicted file as a merge: Save and Finish tells git it’s resolved, Abort that it isn’t. If Logsift is open, they open in its window; if not, a window opens just for them and closes when you’re done.

From a terminal: logsift --diff LEFT RIGHT and logsift --merge LOCAL REMOTE BASE MERGED do the same.

Folders

Choose a folder (or a zip) on each side and click Compare: one table shows both, a row per file or folder, with its name, size and time on each side and, in the middle, = the same, ≠ different, ◀ only on the left or ▶ only on the right.

Two releases compared: a changed config, a file added, one gone, the folders with differences opened